Ask Your Question
0

[Solved] OpenCv 3 and link problem

asked 2015-09-21 06:05:00 -0600

updated 2015-09-25 11:16:56 -0600

eigen_faces.cpp:-1: error: undefined reference to cv::LDA::subspaceProject(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)'** eigen_faces.cpp:-1: error: **undefined reference tocv::Algorithm::Algorithm()'

I have already linked all libraries, see above: LIBS += ../../opencv-3.0.0/lib/libopencv_adas300.a LIBS += ../../opencv-3.0.0/lib/libopencv_aruco300.a LIBS += ../../opencv-3.0.0/lib/libopencv_aruco_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_bgsegm300.a LIBS += ../../opencv-3.0.0/lib/libopencv_bgsegm_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_bioinspired300.a LIBS += ../../opencv-3.0.0/lib/libopencv_bioinspired_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_calib3d300.a LIBS += ../../opencv-3.0.0/lib/libopencv_calib3d_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_ccalib300.a LIBS += ../../opencv-3.0.0/lib/libopencv_ccalib_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_core300.a LIBS += ../../opencv-3.0.0/lib/libopencv_core_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_datasets300.a LIBS += ../../opencv-3.0.0/lib/libopencv_dnn300.a LIBS += ../../opencv-3.0.0/lib/libopencv_dnn_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_dpm300.a LIBS += ../../opencv-3.0.0/lib/libopencv_dpm_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_face300.a LIBS += ../../opencv-3.0.0/lib/libopencv_face_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_features2d300.a LIBS += ../../opencv-3.0.0/lib/libopencv_features2d_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_flann300.a LIBS += ../../opencv-3.0.0/lib/libopencv_flann_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_hal300.a LIBS += ../../opencv-3.0.0/lib/libopencv_hal_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_highgui300.a LIBS += ../../opencv-3.0.0/lib/libopencv_highgui_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_imgcodecs300.a LIBS += ../../opencv-3.0.0/lib/libopencv_imgcodecs_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_imgproc300.a LIBS += ../../opencv-3.0.0/lib/libopencv_imgproc_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_line_descriptor300.a LIBS += ../../opencv-3.0.0/lib/libopencv_line_descriptor_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_ml300.a LIBS += ../../opencv-3.0.0/lib/libopencv_ml_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_objdetect300.a LIBS += ../../opencv-3.0.0/lib/libopencv_objdetect_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_optflow300.a LIBS += ../../opencv-3.0.0/lib/libopencv_optflow_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_photo300.a LIBS += ../../opencv-3.0.0/lib/libopencv_photo_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_reg300.a LIBS += ../../opencv-3.0.0/lib/libopencv_reg_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_rgbd300.a LIBS += ../../opencv-3.0.0/lib/libopencv_rgbd_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_saliency300.a LIBS += ../../opencv-3.0.0/lib/libopencv_saliency_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_shape300.a LIBS += ../../opencv-3.0.0/lib/libopencv_shape_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_stereo300.a LIBS += ../../opencv-3.0.0/lib/libopencv_stereo_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_stitching300.a LIBS += ../../opencv-3.0.0/lib/libopencv_stitching_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_structured_light300.a LIBS += ../../opencv-3.0.0/lib/libopencv_structured_light_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_superres300.a LIBS += ../../opencv-3.0.0/lib/libopencv_superres_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_surface_matching300.a LIBS += ../../opencv-3.0.0/lib/libopencv_surface_matching_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_text300.a LIBS += ../../opencv-3.0.0/lib/libopencv_text_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_tracking300.a LIBS += ../../opencv-3.0.0/lib/libopencv_tracking_pch_dephelp.a LIBS += ../../opencv-3.0.0/lib/libopencv_ts300.a LIBS += ../../opencv-3.0.0/lib/libopencv_ts_pch_dephelp.a LIBS ... (more)

edit retag flag offensive close merge delete

Comments

  • are those static libs ? in that case, the order matters, e.g. if face depends on core, core has to go after face

  • mingw / gcc will never complain about non-existing libs, or wrong path

  • you do not need the pch_dephelp.a things
  • rather try to use -L /path/to/libs and -lopencv_something (without .a or similar)
berak gravatar imageberak ( 2015-09-23 23:06:34 -0600 )edit

In desperation I have linked all libraries. I have tried to change the rows order but nothing. Each time I have obtained a different linker error. On Linux the same order works perfectly.

Denis Gottardello gravatar imageDenis Gottardello ( 2015-09-24 03:05:04 -0600 )edit

are those static libs ?

berak gravatar imageberak ( 2015-09-24 03:13:11 -0600 )edit

As static because if I use -DBUILD_SHARED_LIBS=ON I obtain ar error at cmake time.

Denis Gottardello gravatar imageDenis Gottardello ( 2015-09-24 07:16:16 -0600 )edit

then, linking order definitely matters.

(also, please do not make answers, when it should be a comment..)

berak gravatar imageberak ( 2015-09-24 07:31:48 -0600 )edit
1

Try to use cmake to build your application, please take a look at the example project included in OpenCV: https://github.com/Itseez/opencv/tree...

mshabunin gravatar imagemshabunin ( 2015-09-24 07:38:59 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-09-25 11:15:54 -0600

Solved after many weeks on trying. The linker wants exactly only the libraries listed above, with exactly this order. The libraries can be required more than one time.

Can you help me this the ticket http://answers.opencv.org/question/64... ???

LIBS += ../../opencv-3.0.0/lib/libopencv_core300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_imgcodecs300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_objdetect300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_imgproc300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_face300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_videoio300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_highgui300.a
LIBS += ../../opencv-3.0.0/lib/libopencv_video300.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/libzlib.a
LIBS += ../../opencv-3.0.0/lib/libopencv_hal300.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/liblibjpeg.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/liblibwebp.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/liblibtiff.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/liblibpng.a
LIBS += ../../opencv-3.0.0/lib/libopencv_core300.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\libvfw32.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\libole32.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\liboleaut32.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\libuuid.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\libgdi32.a
LIBS += C:\Qt\Qt5.5.0\Tools\mingw492_32\i686-w64-mingw32\lib\libcomdlg32.a
LIBS += ../../opencv-3.0.0/3rdparty/lib/libzlib.a
LIBS += ../../opencv-3.0.0/lib/libopencv_hal300.a
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-09-21 06:05:00 -0600

Seen: 2,254 times

Last updated: Sep 25 '15