尝试使用OpenCV在C中编译时出现问题

时间:2012-04-17 08:17:41

标签: c opencv compiler-errors arm

我正在尝试使用ARM中的OpenCV编译C代码。当我尝试编译时,我正在使用下一个标志

-L/usr/lib
-lpthread
-lrt
-l
-I/usr/local/include/opencv
-I/usr/local/include
-L/usr/local/lib
-lopencv_core
-lopencv_imgproc
-lopencv_highgui
-lopencv_ml
-lopencv_video
-lopencv_features2d
-lopencv_calib3d
-lopencv_objdetect
-lopencv_contrib
-lopencv_legacy
-lopencv_flann

我收到此错误:

cannot find -lopencv_core
cannot find -lopencv_imgproc
cannot find -lopencv_flann

我的pkg-config --cflags opencv:

-I/usr/local/include/opencv -I/usr/local/include  

pkg-config --libs opencv:

-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann 

这里有什么问题? 提前谢谢。

1 个答案:

答案 0 :(得分:2)

您的编译行暗示您要链接到静态库,因此您需要.a文件而不是.so(.shared对象)。见:

Linking to static/dynamic libraries.

可能有用的信息。虽然面向Linux,但它不是特定于Linux的。我假设你使用gcc而不是llvm,虽然编译器标志可能是相同的。