caffe装matlab接口报错Makefile:518: recipe for target 'matlab/+caffe/private/caffe_.mexa64' failed

$make matcaffe -j8
MEX matlab/+caffe/private/caffe_.cpp
使用 'g++' 编译。
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp: In function ‘void delete_solver(int, mxArray**, int, const mxArray**)’:
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:3: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error: no matching function for call to ‘remove_if(std::vector<boost::shared_ptr<caffe::Solver<float> > >::iterator, std::vector<boost::shared_ptr<caffe::Solver<float> > >::iterator, delete_solver(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Solver<float> >&)>)’
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: note: candidate is:
In file included from /usr/include/c++/4.7/algorithm:63:0,
                 from ./include/caffe/blob.hpp:4,
                 from ./include/caffe/caffe.hpp:7,
                 from /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:18:
/usr/include/c++/4.7/bits/stl_algo.h:1166:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error: template argument for ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ uses local type ‘delete_solver(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Solver<float> >&)>’
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:208:4: error:   trying to instantiate ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp: In function ‘void delete_net(int, mxArray**, int, const mxArray**)’:
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:3: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error: no matching function for call to ‘remove_if(std::vector<boost::shared_ptr<caffe::Net<float> > >::iterator, std::vector<boost::shared_ptr<caffe::Net<float> > >::iterator, delete_net(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Net<float> >&)>)’
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: note: candidate is:
In file included from /usr/include/c++/4.7/algorithm:63:0,
                 from ./include/caffe/blob.hpp:4,
                 from ./include/caffe/caffe.hpp:7,
                 from /home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:18:
/usr/include/c++/4.7/bits/stl_algo.h:1166:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error: template argument for ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’ uses local type ‘delete_net(int, mxArray**, int, const mxArray**)::<lambda(const boost::shared_ptr<caffe::Net<float> >&)>’
/home/zkk/caffe/matlab/+caffe/private/caffe_.cpp:293:4: error:   trying to instantiate ‘template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)’

Makefile:518: recipe for target 'matlab/+caffe/private/caffe_.mexa64' failed
make: *** [matlab/+caffe/private/caffe_.mexa64] Error 255
已邀请:
我也遇到了类似的问题,貌似是编译的时候没有-std=c++11, 修改makefile里面的
CXXFLAGS,添加CXXFLAGS += -std=c++11.然后重新编译就可以了
 

atlantis - 一点一滴

赞同来自:

我也遇到了相同的问题,请问是在makefile文件而不是在makefile.config修改吗?我在makefile里查到CXXFLAGS有好几处,我是将图中的CXXFLAGS += -MMD -MP修改为CXXFLAGS += -std=c++11,但是没效果,求解答。。。。。

Screenshot_from_2017-02-27_22-58-14.jpg

 

dhhcj

赞同来自:

请问LZ解决了吗?

heroxx2011

赞同来自:

同样问题,楼主好人 能不能详细解答一下?

zkk1991 - 90后

赞同来自:

在Makefile里面,大约第410行那一句话CXXFLAGS += -MMD -MP下面添加CXXFLAGS += -std=c++11,最后是这样
CXXFLAGS += -MMD -MP
CXXFLAGS += -std=c++11
然后在caffe根目录下make clean,make all

要回复问题请先登录注册