在ubuntu14.04上编译caffe-1.0时出现opencv错误

时间:2017-05-03 06:31:42

标签: c++ opencv ubuntu caffe

在使用opencv编译最新的caffe-1.0时,我遇到了一个错误 我使用gcc-4.8.5和cuda8.0以及cudnn5.1在ubuntu14.04上编译了它。
我尝试了不同版本的opencv(2.4.8,2.4.13,3.2.0),但错误仍在继续 错误如下:

/usr/include/opencv2/core/core.hpp:4127:9: error: expected identifier before ‘float’
FLOAT=REAL, //!< synonym or REAL
^
/usr/include/opencv2/core/core.hpp:4127:9: error: expected ‘}’ before ‘float’
In file included from examples/cpp_classification/classification.cpp:3:0:
/usr/include/opencv2/core/core.hpp:4127:14: error: expected unqualified-id before ‘=’ token
FLOAT=REAL, //!< synonym or REAL
^
/usr/include/opencv2/core/core.hpp:4140:22: error: expected unqualified-id before ‘)’ token
CV_WRAP FileNode();
^
/usr/include/opencv2/core/core.hpp:4142:14: error: expected unqualified-id 
before ‘const’
FileNode(const CvFileStorage* fs, const CvFileNode* node);
^
/usr/include/opencv2/core/core.hpp:4142:14: error: expected ‘)’ before ‘const’
/usr/include/opencv2/core/core.hpp:4144:14: error: expected unqualified-id before ‘const’
FileNode(const FileNode& node);
^
/usr/include/opencv2/core/core.hpp:4144:14: error: expected ‘)’ before ‘const’
/usr/include/opencv2/core/core.hpp:4146:49: error: non-member function ‘cv::FileNode cv::operator[](const string&)’ cannot have cv-qualifier
FileNode operator[](const string& nodename) const;

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。

发生错误是因为我编译并安装了最新的OpenBlas库,版本0.2.19。文件cblas.h导致了opencv问题。

我刚刚在/ usr / local / include中重命名了cblas.h,所以命令make将使用/ usr / include中的cblas.h并最终成功。