Skip to content

Unable to import Swift framework due to name conflicts with NS_SWIFT_NAME(pow) #21725

@ryansburgoyne

Description

@ryansburgoyne
System information (version)
  • OpenCV => 4.5.5
  • Operating System / Platform => macOS 12.2.1
  • Compiler => Xcode 13.2.1
Detailed description

Importing OpenCV framework to Swift fails with the error "Too few arguments provided to function-like macro invocation". Upon further inspection it appears that the NS_SWIFT_NAME macro used for the function pow is encountering a conflict with the global macro pow.

Steps to reproduce
  1. Download the iOS pack from the OpenCV 4.5.5 release
  2. Add it to an Xcode project
  3. Add an import opencv2 file to a Swift file
  4. Try to build the project

Encounter the error:

opencv2.framework/Headers/Core.h:2524:89: Too few arguments provided to function-like macro invocation
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include/tgmath.h:495:9: Macro 'pow' defined here
Could not build Objective-C module 'opencv2'
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions