使用以下命令构建 opencv 静态库:
BUILD_SHARED_LIBS = OFF
build_opencv_core = ON
build_opencv_imgproc = ON
build_opencv_highgui = ON
WITH_FFMPEG = ON
WITH_PNG = ON
WITH_JASPER = ON
WITH_TIFF = ON
WITH_OPENEXR = ON
和其他关
图书馆建设很好
现在,我创建了新的 Qt 项目
INCLUDEPATH += -I/usr/local/include
LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
在 main.cpp
#include <QCoreApplication>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
int main(int argc,char** argv)
{
QCoreApplication a(argc,argv);
CvCapture* capture = cvCaptureFromCam(0);
return a.exec();
}
但是当我构建我的项目时,我得到下一个错误:
Undefined symbols for architecture i386:
"_cvCreateCameraCapture", referenced from:
_main in main.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Undefined symbols for architecture x86_64:
"_cvCreateCameraCapture", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/ff/wbcdn98j5nx617_p5vpzq1cm0000gn/T//ccqFaXgY.out (No such file or directory)
make: *** [TestCamera] Error 1
-
lipo -info /usr/local/lib/libopencv_highgui.a
Architectures in the fat file: /usr/local/lib/libopencv_highgui.a are: i386 x86_64