0

以下を使用して 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

その他OFF

ライブラリのビルドは良い

そして今、新しい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
4

1 に答える 1