0
我想在Objective-C++(因此使用.m,.mm和.cpp文件)中使用Xcode開發iOS應用程序。 .cpp文件使用第三方庫(OpenCV)。Xcode:鏈接到C++庫因爲不同的體系結構而失敗
構建失敗的鏈接,像這樣的警告(這導致未定義引用錯誤):
ld: warning: ignoring file /opt/local/lib/libopencv_calib3d.dylib,
file was built for unsupported file format
(0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0)
which is not the architecture being linked (i386):
/opt/local/lib/libopencv_calib3d.dylib
我的弓是I386。
我可以在構建日誌Xcode中運行以下命令來查看:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 ...
我不知道它是否有關,但是當我在一個終端上鍵入llvm-g++ --version
,我得到:
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
我能做些什麼來使所有的東西都建立在相同的架構上?
但是它的執行似乎與我從MacPorts獲得的x86_64 OpenCV庫不完全一樣。例如,函數imread不起作用,所以我不得不查看Github repo來發現他們將自己的_image定義爲matrix_函數。 – Neptilo