我正在使用NetBeans 7.0.1在Ubuntu 11.10上使用OpenCV 2.4.0开发C++应用程序。当我尝试构建应用程序时,出现以下链接错误消息。
undefined reference to `cvCreateSubdivDelaunay2D(CvRect, CvMemStorage*)'
undefined reference to `cvSubdivDelaunay2DInsert(CvSubdiv2D*, cv::Point_<int>)'
我已经链接到以下库。
libopencv_calib3d_pch_dephelp.a
libopencv_calib3d.so
libopencv_calib3d.so.2.4
libopencv_calib3d.so.2.4.0
libopencv_contrib_pch_dephelp.a
libopencv_contrib.so
libopencv_contrib.so.2.4
libopencv_contrib.so.2.4.0
libopencv_core_pch_dephelp.a
libopencv_core.so
libopencv_core.so.2.4
libopencv_core.so.2.4.0
libopencv_features2d_pch_dephelp.a
libopencv_features2d.so
libopencv_features2d.so.2.4
libopencv_features2d.so.2.4.0
libopencv_flann_pch_dephelp.a
libopencv_flann.so
libopencv_flann.so.2.4
libopencv_flann.so.2.4.0
libopencv_gpu_pch_dephelp.a
libopencv_gpu.so
libopencv_gpu.so.2.4
libopencv_gpu.so.2.4.0
libopencv_haartraining_engine.a
libopencv_highgui_pch_dephelp.a
libopencv_highgui.so
libopencv_highgui.so.2.4
libopencv_highgui.so.2.4.0
libopencv_imgproc_pch_dephelp.a
libopencv_imgproc.so
libopencv_imgproc.so.2.4
libopencv_imgproc.so.2.4.0
libopencv_legacy_pch_dephelp.a
libopencv_legacy.so
libopencv_legacy.so.2.4
libopencv_legacy.so.2.4.0
libopencv_ml_pch_dephelp.a
libopencv_ml.so
libopencv_ml.so.2.4
libopencv_ml.so.2.4.0
libopencv_nonfree_pch_dephelp.a
libopencv_nonfree.so
libopencv_nonfree.so.2.4
libopencv_nonfree.so.2.4.0
libopencv_objdetect_pch_dephelp.a
libopencv_objdetect.so
libopencv_objdetect.so.2.4
libopencv_objdetect.so.2.4.0
libopencv_perf_calib3d_pch_dephelp.a
libopencv_perf_core_pch_dephelp.a
libopencv_perf_features2d_pch_dephelp.a
libopencv_perf_gpu_pch_dephelp.a
libopencv_perf_highgui_pch_dephelp.a
libopencv_perf_imgproc_pch_dephelp.a
libopencv_perf_nonfree_pch_dephelp.a
libopencv_perf_objdetect_pch_dephelp.a
libopencv_perf_photo_pch_dephelp.a
libopencv_perf_stitching_pch_dephelp.a
libopencv_perf_video_pch_dephelp.a
libopencv_photo_pch_dephelp.a
libopencv_photo.so
libopencv_photo.so.2.4
libopencv_photo.so.2.4.0
libopencv_stitching_pch_dephelp.a
libopencv_stitching.so
libopencv_stitching.so.2.4
libopencv_stitching.so.2.4.0
libopencv_test_calib3d_pch_dephelp.a
libopencv_test_contrib_pch_dephelp.a
libopencv_test_core_pch_dephelp.a
libopencv_test_features2d_pch_dephelp.a
libopencv_test_highgui_pch_dephelp.a
libopencv_test_imgproc_pch_dephelp.a
libopencv_test_legacy_pch_dephelp.a
libopencv_test_ml_pch_dephelp.a
libopencv_test_nonfree_pch_dephelp.a
libopencv_test_objdetect_pch_dephelp.a
libopencv_test_photo_pch_dephelp.a
libopencv_test_stitching_pch_dephelp.a
libopencv_test_video_pch_dephelp.a
libopencv_ts_pch_dephelp.a
libopencv_ts.so
libopencv_ts.so.2.4
libopencv_ts.so.2.4.0
libopencv_video_pch_dephelp.a
libopencv_video.so
libopencv_video.so.2.4
libopencv_video.so.2.4.0
libopencv_videostab_pch_dephelp.a
libopencv_videostab.so
libopencv_videostab.so.2.4
libopencv_videostab.so.2.4.0
libraries.txt
我将不胜感激,有人可以告诉我如何解决此错误。
提前谢谢了,
彼得
最佳答案
在2.4.0中,cvSubdivDelaunay2DInsert
位于 libopencv_legacy.so 中,因此cvCreateSubdivDelaunay2D
也应根据源代码进行,但最新版本未在Mac OS X上编译的库中找到。
要验证此信息,请转到OpenCV库目录并执行nm
。如果结果在符号名称前出现字母T,则意味着实现该符号的库是:
$ nm libopencv_legacy.so | grep cvSubdivDelaunay2DInsert
00000000000b5200 T _cvSubdivDelaunay2DInsert
如果使用此技巧无法找到
cvCreateSubdivDelaunay2D
,请考虑将filing视为错误。