Ask Your Question
1

Traincascade link problem?

asked Sep 19 '12

Hello,

Since this is my first post, I will try to make it as clear as possible so that people could try to find the reason of this error together with me.

Brief: I am running openCV 2.4.2 on Windows 7 x64 and with Visual Studio 2010 C++ compiler

As followed by multiple guides online I made sure the following configurations were made

1) Be sure that Visual Studio knows that the win32 console application is for x64 bit system

2) At the C/C++ general settings of the project I got the following additional include directories

  • D:\OpenCV2.4\build\include
  • D:\OpenCV2.4\build\include\opencv
  • D:\OpenCV2.4\build\include\opencv2

3) At the linker settings I added at general settings the following additional library directory

  • D:\OpenCV2.4\build\x64\vc10\lib\

4) At the linker settings I added at the input settings the following additional dependencies

  • opencv_core240d.lib
  • opencv_imgproc240d.lib
  • opencv_highgui240d.lib
  • opencv_objdetect240d.lib
  • opencv_calib3d240d.lib
  • opencv_video240d.lib
  • opencv_features2d240d.lib
  • opencv_flann240d.lib
  • opencv_legacy240d.lib

5)Included inside the project is all the files that can be found for the traincascade application under the folder:

  • D:\OpenCV2.4\apps\traincascade\

This all should be enough to compile the traincascade.cpp file, in order to be able to train a classifier myself.

But I keep getting the following linking errors:

1>------ Build started: Project: traincascade, Configuration: Debug x64 ------
1>Build started 19/09/2012 16:02:53.
1>InitializeBuildStatus:
1> Touching "x64\Debug\traincascade.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>traincascade.obj : error LNK2019: unresolved external symbol "public: bool __cdecl CvCascadeClassifier::train(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,classCvCascadeParams const &,class CvFeatureParams const &,struct CvCascadeBoostParams const &,bool)" (?train@CvCascadeClassifier@QEAA_NV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2@std@00HHHHHAEBVCvCascadeParams@AEBVCvFeatureParams@AEBUCvCascadeBoostParams@_N@Z) referenced in function main
1>traincascade.obj : error LNK2019: unresolved external symbol "public: virtual bool __cdecl CvCascadeBoostParams::scanAttr(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?scanAttr@CvCascadeBoostParams@UEAA_NV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2@std@0@Z) referenced in function main
1>traincascade.obj : error LNK2019: unresolved external symbol "public: virtual bool __cdecl CvCascadeParams::scanAttr(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?scanAttr@CvCascadeParams@UEAA_NV?$basic_string@DU?$char_traits@D@std@V?$allocator@D@2@std@0@Z) referenced in function main
1>traincascade.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl CvCascadeBoostParams::printDefaults(void)const " (?printDefaults@CvCascadeBoostParams@UEBAXXZ) referenced in function main
1>traincascade.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl CvCascadeParams::printDefaults ...
(more)
Preview: (hide)

2 answers

Sort by » oldest newest most voted
0

answered Sep 20 '12

Daniil Osokin gravatar image

Hi! You can try to do the steps from the answer for this post: Retrying to use opencv: this time 25 linker errors- win7 64bit vc10 vs2010. There everything works.

You say, that used 2.4.2 version, but in the example you use 2.4.0 libs. May be this is the problem.

Preview: (hide)

Comments

I am going to try the solution presented in the link you provided me. About the libraries. If you download the 2.4.2 version, the precompiled windows libraries are 2.4.0. However this should not pose a problem, since the app should be in 2.4.0 also, and all my other openCV projects run just fine.

I will keep you posted!

StevenPuttemans gravatar imageStevenPuttemans (Sep 20 '12)edit

When I downloaded 2.4.2 there were 2.4.2 suffixes for libs. It's strange. I'll try to re-download and check, if you still can't build this.

Daniil Osokin gravatar imageDaniil Osokin (Sep 20 '12)edit

Yeah i just downloaded 2.4.2 now and the suffixes are correct now. I didn't see that the main openCV page has version 2.4.0, my mistake. However, traincascade should work in that version also.

Trying to configure the solution on the link you provided, seems that it is completely going wrong now. Keep you posted on how it goes!

StevenPuttemans gravatar imageStevenPuttemans (Sep 20 '12)edit

Ok small update 1) Downloaded 2.4.2 and configured console project exactly like you said 2) Browsed towards apps/traincascade --> copied all files towards my own project 3) Loaded the traincascade.cpp 4) Added a link to every single lib that there is in 2.4.2 5) Still exactly the same 17 link errors Maybe you could try to run the example?

StevenPuttemans gravatar imageStevenPuttemans (Sep 20 '12)edit
1

answered Sep 20 '12

Problem solved!

What happened was the following. I am guessing the source code for the traincascade wasn't compiled correctly since i just did it manually by adding all files to the project and building it completely. This resulted in a working end result.

Cheerz! Thanks for all help presented!

Preview: (hide)

Comments

Please, close this question (or mark answered).

Daniil Osokin gravatar imageDaniil Osokin (Sep 20 '12)edit

Hi StevenPuttemans,

I have the exact same problem as you did before. Could you please clarify what you did to to get resolve the errors.

Also what do you mean that the traincascade wasn't compiled correctly. I also did what I think you did, which was creating each file manually (the main.cpp + the header files) and then build.

Thanks, txho

txho gravatar imagetxho (Mar 30 '13)edit

If linker errors keep arising after you compiled the traincascade source code, than 2 problems are still possible:

  1. You did not add the lib folder of openCV to your systems path variable

  2. You did not link your project with all necessary libraries in your project settings.

Go a bit up, there is a link, please follow all steps mentioned there.

StevenPuttemans gravatar imageStevenPuttemans (Mar 30 '13)edit

I checked the steps from the link mention above. I ran a test program with camera capture. it builds and run.

However the traincascade codes from the app that comes with opencv still gives me errors.....

here is a link to download my project. Please take a look at it and please let me know what I am missing. http://www.4shared.com/rar/5GXMcF98/Rover_Detect_Sample_Cascade.html?

In addition, could send me your project folder for your traincasacade?

txho gravatar imagetxho (Mar 30 '13)edit

I am not sending out my code, since it contains specific company information, which i cannot share. Please post your error also please, how else can we know what goes wrong?

StevenPuttemans gravatar imageStevenPuttemans (Mar 30 '13)edit

Question Tools

Stats

Asked: Sep 19 '12

Seen: 1,659 times

Last updated: Sep 20 '12