opencv,使用cmake构建c ++项目时链接错误

时间:2014-01-29 11:55:40

标签: c++ opencv cmake

我试图通过执行:make来构建一个c ++项目,但是我得到了这些错误:

/usr/bin/ld: cannot find -lcv 
/usr/bin/ld: cannot find -lcxcore   
/usr/bin/ld: cannot find -lml

我有opencv库:

$ pkg-config --cflags --libs opencv
    -I/usr/include/opencv  -lopencv_calib3d -lopencv_contrib -lopencv_core  
    -lopencv_feathures2d -lopencv_flann -lopencv_gpu -lopencv_highgui     
    -lopencv_imgproc -lopencv_lagecy -lopencv_ml -lopencv_objdetect -lopencv_ocl 
    -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video                                  
    -lopencv_videostab

1 个答案:

答案 0 :(得分:1)

这意味着您要求链接器链接到库“cv,cxcore,ml”,但链接器无法找到它们。正如BoBTFish建议的那样;让pkg-config为您执行此操作:

g++ `pkg-config --libs opencv` etc...