c++objective-cxcodeopencvartoolkit

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


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!


Solution

  • 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