编译程序用到opencv库, 链接时候出错

znglyfe 2017-08-02 06:46:03
编译应用程序的时候,链接opencv库的时候总是报错,相关库是有的,路径也是对的,不知道为什么,
CMakeFiles/figure.dir/main.cpp.o: In function `MainLoop(void*)':
main.cpp:(.text+0x9f0): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
CMakeFiles/figure.dir/main.cpp.o: In function `regiestLoop(void*)':
main.cpp:(.text+0x1eec): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
CMakeFiles/figure.dir/main.cpp.o: In function `UI_Init()':
main.cpp:(.text+0x2638): undefined reference to `cv::imread(cv::String const&, int)'
CMakeFiles/figure.dir/main.cpp.o: In function `cv::String::String(char const*)':
main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to `cv::String::allocate(unsigned int)'
CMakeFiles/figure.dir/main.cpp.o: In function `cv::String::~String()':
main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x18): undefined reference to `cv::String::deallocate()'
CMakeFiles/figure.dir/main.cpp.o: In function `cv::String::operator=(cv::String const&)':
main.cpp:(.text._ZN2cv6StringaSERKS0_[_ZN2cv6StringaSERKS0_]+0x38): undefined reference to `cv::String::deallocate()'
CMakeFiles/figure.dir/main.cpp.o: In function `cv::Mat::Mat(int, int, int, void*, unsigned int)':
main.cpp:(.text._ZN2cv3MatC2EiiiPvj[_ZN2cv3MatC5EiiiPvj]+0x148): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
main.cpp:(.text._ZN2cv3MatC2EiiiPvj[_ZN2cv3MatC5EiiiPvj]+0x26c): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
collect2: error: ld returned 1 exit status
make[3]: *** [figure] Error 1
make[2]: *** [CMakeFiles/figure.dir/all] Error 2
make[1]: *** [CMakeFiles/figure.dir/rule] Error 2
make: *** [figure] Error 2



cmakelist中的部分设置


link_directories("/home/zng/zng/X1000V5.0/out/product/rat/system/lib/"
"/home/zng/zng/app/mips-opencv/lib"
"/home/zng/zng/X1000V5.0/out/product/rat/system/usr/lib/"
"/home/zng/zng/app/mips-opencv/3rdparty/lib/"
"/home/zng/zng/app/freetype/")

link_libraries("dl" "pthread" "opencv_imgproc" "opencv_highgui" "opencv_core" "zlib" "libjasper" "libjpeg" "libpng" "IlmImf" "libtiff" "rt" "z" "freetype")

这些库在对应的路径下都是有的,求教各位大神。
...全文
521 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
robertbo 2017-08-03
  • 打赏
  • 举报
回复
undefined reference这种一般是缺少头文件的错误

21,595

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧