2016-03-05 67 views
0

我試圖編譯在OS X 10.10.5一個朱古力分類例如,使用下面的命令:錯誤編譯朱古力分類

g++ -ggdb `pkg-config --cflags --libs opencv` -I /Users/SullyChen/caffe/include -I /usr/local/cuda/include -I /usr/local/Cellar/openblas/0.2.15/include -lboost_system -lglog -lprotobuf classification.cpp -o classification 

,但我得到了以下錯誤:

Undefined symbols for architecture x86_64: 
    "caffe::ReadProtoFromBinaryFile(char const*, google::protobuf::Message*)", referenced from: 
     caffe::ReadProtoFromBinaryFileOrDie(char const*, google::protobuf::Message*) in classification-ff6167.o 
    "caffe::Net<float>::CopyTrainedLayersFrom(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from: 
     Classifier::Classifier(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
    "caffe::Net<float>::Forward(float*)", referenced from: 
     Classifier::Predict(cv::Mat const&) in classification-ff6167.o 
    "caffe::Net<float>::Reshape()", referenced from: 
     Classifier::Predict(cv::Mat const&) in classification-ff6167.o 
    "caffe::Net<float>::Net(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, caffe::Phase, caffe::Net<float> const*)", referenced from: 
     Classifier::Classifier(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
    "caffe::Blob<float>::mutable_cpu_data()", referenced from: 
     Classifier::SetMean(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
     Classifier::WrapInputLayer(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >*) in classification-ff6167.o 
    "caffe::Blob<float>::Reshape(int, int, int, int)", referenced from: 
     Classifier::Predict(cv::Mat const&) in classification-ff6167.o 
    "caffe::Blob<float>::FromProto(caffe::BlobProto const&, bool)", referenced from: 
     Classifier::SetMean(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
    "caffe::Caffe::Get()", referenced from: 
     caffe::Caffe::set_mode(caffe::Caffe::Brew) in classification-ff6167.o 
    "caffe::BlobProto::BlobProto()", referenced from: 
     Classifier::SetMean(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
    "caffe::BlobProto::~BlobProto()", referenced from: 
     Classifier::SetMean(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in classification-ff6167.o 
    "caffe::Blob<float>::cpu_data() const", referenced from: 
     Classifier::Predict(cv::Mat const&) in classification-ff6167.o 
     Classifier::Preprocess(cv::Mat const&, std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >*) in classification-ff6167.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

關於什麼問題的任何想法?

回答

0

哦,我的天啊,我忘了鏈接Caffe ...那麼問題就解決了。

編輯:這是我在任何情況下使用的命令需要它

g++ -ggdb `pkg-config --cflags --libs opencv` -I /Users/SullyChen/caffe/include -I /usr/local/cuda/include -I /usr/local/Cellar/openblas/0.2.15/include -lboost_system -lglog -lprotobuf -L /Users/SullyChen/caffe/.build_release/lib -lcaffe classification.cpp -o classification 
相關問題