我已经使用已编译的openCV版本用于Raspberry Pi。 link for anyone who is interested
尝试使用此命令行编译之后
g++ test3.cpp -o test3 -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lopencv_core -lopencv_highgui -lopencv_imgproc -lwiringPi -lpthread
我收到以下错误行。
// usr / local / lib / libopencv_stitching.so.2.4:对`cv :: gpu :: ensureSizeIsEnough(int,int,int,cv :: gpu :: GpuMat&)的未定义引用'
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: parallel_for_(cv :: Range const&,cv :: ParallelLoopBody const&,double)'的未定义引用
// usr / local / lib / libopencv_calib3d.so.2.4:对cv :: ParallelLoopBody的`typeinfo的未定义引用
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: Mutex :: unlock()'的未定义引用
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: Mutex :: lock()'的未定义引用
// usr / local / lib / libopencv_ocl.so.2.4:对cv的未定义引用:: TLSDataContainer :: getData()const
// usr / local / lib / libopencv_features2d.so.2.4:对cv的未定义引用:: AlgorithmInfo :: addParam(cv :: Algorithm&,char const *,unsigned char&,bool,unsigned char(cv :: Algorithm :: )(),void(cv :: Algorithm :: )(unsigned char),std :: basic_string,std :: allocator> const&)
// usr / local / lib / libopencv_features2d.so.2.4:未定义引用`cv :: AlgorithmInfo :: addParam(cv :: Algorithm&,char const *,float&,bool,float(cv :: Algorithm) :: )(),void(cv :: Algorithm :: )(float),std :: basic_string,std :: allocator> const&)'
// usr / local / lib / libopencv_features2d.so.2.4:未定义引用`cv :: AlgorithmInfo :: addParam(cv :: Algorithm&,char const *,short&,bool,int(cv :: Algorithm) :: )(),void(cv :: Algorithm :: )(int),std :: basic_string,std :: allocator> const&)'
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: Mutex :: Mutex()'的未定义引用
// usr / local / lib / libopencv_ocl.so.2.4:对`cv :: TLSDataContainer :: TLSDataContainer()'的未定义引用
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: ParallelLoopBody ::〜ParallelLoopBody()'的未定义引用
// usr / local / lib / libopencv_calib3d.so.2.4:对`cv :: Mutex ::〜Mutex()'的未定义引用
// usr / local / lib / libopencv_ocl.so.2.4:对`cv :: TLSDataContainer ::〜TLSDataContainer()'的未定义引用 collect2:ld返回1退出状态
答案 0 :(得分:0)
您尚未将可执行文件与程序所需的多个库链接
尝试使用:
g++ -lpthread `pkg-config opencv --libs` -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lwiringPi test3.cpp -o test3