2012-04-14 83 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扩展名。

相关问题