【发布时间】:2017-01-28 14:21:20
【问题描述】:
我正在尝试使用 caffe 运行我的简单程序,但出现错误
#include <iostream>
#include <caffe/caffe.hpp>
#include <memory>
using namespace std;
using namespace caffe;
int main(int argc, char** argv) {
shared_ptr<Net<float> > net_;
string file_name="it doesn't matter ";
net_.reset(new Net<float>(file_name, TEST));
// or just: Net<float> caffe_test_net(file_name, TEST);
}
它的构建没有问题,但是当我运行程序时出现错误: 符号查找错误:/home/parrot/eclipse/workspace/Test_Caffe/Debug/Test_Caffe:未定义符号:_ZN5caffe3NetIfEC1ERKSsNS_5PhaseEPKS1_
我注意到:当我在代码 caffe::TEST 或 caffe::TRAIN 中使用时出现问题。我认为有一些问题与:caffe::Phase 有关。所以我不能创建 caffe::Net ,因为我不能使用 caffe::TEST。 当我使用 caffe 库中的其他类\函数...等时,不会产生此错误。
我使用 IDE: Eclipse 来构建项目。来自控制台的一些报告:
全部制作
构建文件:../src/Test_Caffe.cpp
调用:Cross G++ 编译器
g++ -I"/home/smilart/0_Intall/1 caffe-rc3/include/" -I/usr/local/cuda-7.5/include/ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Test_Caffe.d" -MT"src/Test_Caffe.o" -o "src/Test_Caffe.o" "../src/Test_Caffe.cpp"
完成构建:../src/Test_Caffe.cpp
构建目标:Test_Caffe
调用:Cross G++ Linker
g++ -L/usr/local/cuda/lib64/ -L"/home/smilart/0_Intall/1 caffe-rc3/build/lib/" -o "Test_Caffe" ./src/Test_Caffe.o -lboost_system -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lcudart -lcublas -lcurand -lboost_filesystem -lglog -lprotobuf -lcaffe
完成构建目标:Test_Caffe
【问题讨论】: