Author Topic: Can't link to the OpenCV library ml with codeblocks  (Read 5532 times)

Rene

  • Guest
Can't link to the OpenCV library ml with codeblocks
« on: July 24, 2009, 01:03:33 am »
Hello,

I'm using OpenCV with Codeblocks and all works fine. But now I need a boosting algorithm out of the machine learning library. I want to link the ml library like I did it with all the other libraries from Opencv (just link them in the linker settings like -lcv -lhighgui ...) but it didn't work. I always get a linker error. I put the build log below. I tried it under linux and it works, but I have to use VISTA.

Someone have an idea?

Thanks

the main:
Code
#include <iostream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <ml.h>

using namespace std;

int main()
{
    CvBoost boost;

    return 0;
}

and the build log:
-------------- Build: Debug in testBoost ---------------

mingw32-g++.exe -L"C:\Program Files\OpenCV\lib"  -o bin\Debug\testBoost.exe obj\Debug\main.o   -lcv -lcvaux -lcxcore -lhighgui -lml 
obj\Debug\main.o: In function `main':
C:/Users/jwie015/Test/testBoost/main.cpp:11: undefined reference to `CvBoost::CvBoost()'
C:/Users/jwie015/Test/testBoost/main.cpp:13: undefined reference to `CvBoost::~CvBoost()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
 

Rene

  • Guest
Re: Can't link to the OpenCV library ml with codeblocks
« Reply #1 on: July 28, 2009, 11:35:56 pm »
Nobody has an idea? or tried to link to the machine learning library?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't link to the OpenCV library ml with codeblocks
« Reply #2 on: July 28, 2009, 11:48:41 pm »
Have you tried:

 nm my_lib | grep -i CvBoost

replace my_lib with all the libs you are linking.

nm is part of mingw, grep you can find with this google query: "grep for win32"
The command is issued in cmd window (window button + r -> cmd -> hit enter)

This is the algorithm I use to debug such problems

Best regards


(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can't link to the OpenCV library ml with codeblocks
« Reply #3 on: July 29, 2009, 12:03:02 am »
Have you tried:

 nm my_lib | grep -i CvBoost

replace my_lib with all the libs you are linking.

nm is part of mingw, grep you can find with this google query: "grep for win32"
The command is issued in cmd window (window button + r -> cmd -> hit enter)

This is the algorithm I use to debug such problems

Best regards




You can do something similar with the "Symbol Table Plugin", reachable via the "Plugins" menu in C::B, it also uses nm, but you can set some options to make search more comfortable, and you don't need to leave C::B to do so  :wink: .