我正在使用C ++在Ubuntu 16.10 LTS上使用openCV 3.3.0在NetBeans 8.0上构建OpenCV项目。
编译错误且无警告。但是,在链接阶段,编译失败,因为_ZN4half5_eLutE被视为未定义。以下显示了链接过程和结果。
cd '/home/peter/NetBeansProjects/ApplyModelToSet'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/peter/NetBeansProjects/ApplyModelToSet'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/applymodeltoset
make[2]: Entering directory '/home/peter/NetBeansProjects/ApplyModelToSet'
mkdir -p dist/Debug/GNU-Linux
g++ -o dist/Debug/GNU-Linux/applymodeltoset applymodeltoset.o build/Debug
/GNU-Linux/_ext/73c876dd/colour.o build/Debug/GNU-Linux/_ext/73c876dd
/correlation.o build/Debug/GNU-Linux/_ext/73c876dd/fft.o build/Debug/GNU-
Linux/_ext/73c876dd/wirth.o build/Debug/GNU-Linux/_ext/73c876dd/xmlReader.o
build/Debug/GNU-Linux/main.o -L../../lib -L/usr/lib/x86_64-linux-gnu
-L../../xerces-c-3.1.4/src/.libs -L../../Downloads/opencv-3.3.0/build/lib
/usr/lib/x86_64-linux-gnu/libpng.a -lxerces-c -lopencv_calib3d
-lopencv_calib3d_pch_dephelp -lopencv_core -lopencv_core_pch_dephelp
-lopencv_dnn -lopencv_dnn_pch_dephelp -lopencv_features2d
-lopencv_features2d_pch_dephelp -lopencv_flann -lopencv_flann_pch_dephelp
-lopencv_highgui -lopencv_highgui_pch_dephelp -lopencv_imgcodecs
-lopencv_imgcodecs_pch_dephelp -lopencv_imgproc
-lopencv_imgproc_pch_dephelp -lopencv_ml -lopencv_ml_pch_dephelp
-lopencv_objdetect -lopencv_objdetect_pch_dephelp
-lopencv_perf_calib3d_pch_dephelp -lopencv_perf_core_pch_dephelp
-lopencv_perf_dnn_pch_dephelp -lopencv_perf_features2d_pch_dephelp
-lopencv_perf_imgcodecs_pch_dephelp -lopencv_perf_imgproc_pch_dephelp
-lopencv_perf_objdetect_pch_dephelp -lopencv_perf_photo_pch_dephelp
-lopencv_perf_stitching_pch_dephelp -lopencv_perf_superres_pch_dephelp
-lopencv_perf_video_pch_dephelp -lopencv_perf_videoio_pch_dephelp
-lopencv_photo -lopencv_photo_pch_dephelp -lopencv_shape
-lopencv_shape_pch_dephelp -lopencv_stitching
-lopencv_stitching_pch_dephelp -lopencv_superres
-lopencv_superres_pch_dephelp -lopencv_test_calib3d_pch_dephelp
-lopencv_test_core_pch_dephelp -lopencv_test_dnn_pch_dephelp
-lopencv_test_features2d_pch_dephelp -lopencv_test_flann_pch_dephelp
-lopencv_test_highgui_pch_dephelp -lopencv_test_imgcodecs_pch_dephelp
-lopencv_test_imgproc_pch_dephelp -lopencv_test_ml_pch_dephelp
-lopencv_test_objdetect_pch_dephelp -lopencv_test_photo_pch_dephelp
-lopencv_test_shape_pch_dephelp -lopencv_test_stitching_pch_dephelp
-lopencv_test_superres_pch_dephelp -lopencv_test_video_pch_dephelp
-lopencv_test_videoio_pch_dephelp -lopencv_test_videostab_pch_dephelp
-lopencv_ts -lopencv_ts_pch_dephelp -lopencv_video
-lopencv_video_pch_dephelp -lopencv_videoio -lopencv_videoio_pch_dephelp
-lopencv_videostab -lopencv_videostab_pch_dephelp -ljpeg -lz -lIlmImf
-lopencv_flann -pthread -lopencv_flann
/usr/bin/ld: ../../lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to symbol '_ZN4half5_eLutE'
//usr/lib/x86_64-linux-gnu/libHalf.so.12: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:102: recipe for target 'dist/Debug/GNU- Linux/applymodeltoset' failed
make[2]: *** [dist/Debug/GNU-Linux/applymodeltoset] Error 1
make[2]: Leaving directory '/home/peter/NetBeansProjects/ApplyModelToSet'
nbproject/Makefile-Debug.mk:97: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/home/peter/NetBeansProjects/ApplyModelToSet'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
据我所知,libopencv_flann.a中定义了几个类似的字符串,但它包括在内。
答案 0 :(得分:0)
我终于明白了。 _ZN4half5_eLutE不是OpenCV 3.3的一部分。 / usr / lib / x86_64-linux-gnu包含早期版本的OpenCV中的库。当我在第一个搜索目录中创建../../Downloads/opencv-3.3.0/build/lib时,问题就消失了,因为不再需要_ZN4half5_eLutE。