undefined reference to `caffe::Net float ::Net(std::__cxx11::basic_string char,问题解决

在原本能正常使用的caffe中修改代码后重新编译,会产生如下错误:

CXX/LD -o .build_release/tools/caffe.bin
.build_release/tools/caffe.o: In function `test()':
caffe.cpp:(.text+0x15b3): undefined reference to `caffe::Net<float>::Net(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, caffe::Phase, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const*, caffe::Net<float> const*)'
.build_release/tools/caffe.o: In function `train()':
caffe.cpp:(.text+0x30a7): undefined reference to `caffe::P2PSync<float>::P2PSync(boost::shared_ptr<caffe::Solver<float> >, caffe::P2PSync<float>*, caffe::SolverParameter const&)'
caffe.cpp:(.text+0x30cc): undefined reference to `caffe::P2PSync<float>::Run(std::vector<int, std::allocator<int> > const&)'
caffe.cpp:(.text+0x30d4): undefined reference to `caffe::P2PSync<float>::~P2PSync()'
caffe.cpp:(.text+0x45ad): undefined reference to `caffe::P2PSync<float>::~P2PSync()'
.build_release/tools/caffe.o: In function `time()':
caffe.cpp:(.text+0x4a43): undefined reference to `caffe::Net<float>::Net(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, caffe::Phase, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const*, caffe::Net<float> const*)'
caffe.cpp:(.text+0x4dc2): undefined reference to `caffe::Layer<float>::Lock()'
caffe.cpp:(.text+0x4eba): undefined reference to `caffe::Layer<float>::Unlock()'
collect2: error: ld returned 1 exit status
Makefile:622: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1
 

解决方法:

在自己的/usr/local/路径下使用find命令查看是否有libcaffe相关的so文件,如果有,则把它们删除之后再次重新编译caffe就能解决上述问题:例如我的在/usr/local/lib/路径下,则执行:

sudo rm libcaffe.*

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值