Compiling artoolkitx-calibration for iOS: C-linkage specified, but returns user-defined type 'cv::Size' which is incompatible with C

こ雲淡風輕ζ 提交于 2019-12-13 02:41:23

问题


I'd like to run the ARToolKitX Calibration app on iOS. Unfortunately, the app isn't available in the App Store, so I assume I'd have to compile it myself. Luckily, I have an active Apple Developer account...

So I got the source code from GitHub:

git clone https://github.com/artoolkitx/artoolkitx-calibration
cd artoolkitx-calibration

Then I downloaded the ARToolKitX iOS library from https://github.com/artoolkitx/artoolkitx/releases/download and I followed the steps in the iOS section of the build.sh script to link this SDK to the Xcode project.

I opened the project with Xcode 9.3 on macOS High Sierra 10.13.3.

I downloaded the opencv2.framework library from SourceForge and linked it: https://sourceforge.net/projects/opencvlibrary/files/opencv-ios/

Xcode reported an issue in line 61 of prefs.hpp:

cv::Size getPreferencesCalibrationPatternSize(void *preferences);

'getPreferencesCalibrationPatternSize' has C-linkage specified, but returns user-defined type 'cv::Size' (aka 'Size_') which is incompatible with C

Any pointer to get a step further in this compilation process would be greatly appreciated!


回答1:


I just had the same problem today. You need to make sure that your source code files, usually the '.c' and the '.h' files, are interpreted as C++ headers and sources. For this specific error, trace back which file calls cv::Size and change its type to C++ header/source.




回答2:


The compilation issue was fixed by removing the following lines around the error-generating usage of cv::Size:

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif


来源:https://stackoverflow.com/questions/50100945/compiling-artoolkitx-calibration-for-ios-c-linkage-specified-but-returns-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!