2012-04-14 81 views
0

我使用的是C接口導入ml.h,我收到以下錯誤剪斷,當我運行NDK建造時,我有「ml.h」:無法在Android的OpenCV的2.3

In file included from /Users/user/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h:61, 
      from /Users/user/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h:62, 
      from /Users/user/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/map:60, 
      from /Users/user/android-opencv/OpenCV-2.3.1/share/OpenCV/../../include/opencv2/ml/ml.hpp:2022, 
      from /Users/user/android-opencv/OpenCV-2.3.1/share/OpenCV/../../include/opencv/ml.h:46, 
      from /Users/user/CarSafe/jni/blink_detection.c:7: 
/Users/user/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/cstddef:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token 

如果我註釋掉「ml.h」的include,它會編譯好並正常運行。

問題是我想在我的C代碼中使用opencv svm庫。我究竟做錯了什麼?或者我應該將它編譯爲C++代碼並在C++中使用ml.hpp頭文件。這適用於項目中的其他代碼。仔細在你的輸出的最後一行

回答

0

看:

/Users/user/android-ndk-r7c/sources/cxx-stl/gnu-libstdc++/include/cstddef:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token 

此基礎上出現你在你的問題寫你試圖用一個C編譯器來編譯使用C++標準庫的代碼。

另外,雖然我不熟悉OpenCV,但我會假設你應該能夠將你的代碼編譯爲C++,並且仍然包含「ml.h」。 C++頭文件不總是使用* .hpp擴展名。

相關問題