1
我想将OpenCV用作静态库。将库编译为静态库后,现在我正在测试一些示例以查看所有依赖关系。OpenCV静态链接错误
的依赖添加到编译为-static
pkg配置--libs OpenCV的-lpthread -ljpeg -ltiff -lz -ljasper -lpng12
但得到以下错误消息:
g++ -c -g -Wall -O2 `pkg-config --cflags opencv` formas.cpp
g++ -g -Wall -O2 `pkg-config --cflags opencv` formas.o -o paint -static `pkg-config --libs opencv` -lpthread -ljpeg -ltiff -lz -ljasper -lpng12
/usr/local/lib/libopencv_core.a(system.o): In function `cv::tempfile(char const*)':
system.cpp:(.text._ZN2cv8tempfileEPKc+0x3a): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/local/lib/libopencv_core.a(system.o): In function `cv::getTickCount()':
system.cpp:(.text._ZN2cv12getTickCountEv+0x2a): undefined reference to `clock_gettime'
/usr/local/lib/libopencv_highgui.a(grfmt_png.o): In function `cv::PngDecoder::readHeader()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xde): undefined reference to `png_set_longjmp_fn'
/usr/local/lib/libopencv_highgui.a(grfmt_png.o): In function `cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x134): undefined reference to `png_set_longjmp_fn'
/usr/local/lib/libopencv_highgui.a(grfmt_png.o): In function `cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x141): undefined reference to `png_set_longjmp_fn'
collect2: ld returned 1 exit status
make: *** [all] Error 1
我做了一些错误或出现一个错误OpenCV库。
OpenCV版本:2.3.1(最新版本) formas - >创建图像并绘制一些图形并保存到文件中的示例。很简单。
在此先感谢。
Ostia,estoy buscando exactamente lo mismo y soymañotambién:P – Wiliam