undefined reference to - OpenCV

Hi Guys,

I would like to learn using the OpenCV Library. For that, i bought the Book "Learn OpenCV" from O'Reilly.
I could install OpenCV and FFmpeg without any problems on my Linux (Kubuntu 10.10)

Now I tried to compile my first project. I get following errors from the g++ compiler:

1
2
3
4
5
6
7
8
/tmp/ccXMRu5f.o: In function `main':
test.cpp:(.text+0x1d): undefined reference to `cvLoadImage'
test.cpp:(.text+0x35): undefined reference to `cvNamedWindow'
test.cpp:(.text+0x49): undefined reference to `cvShowImage'
test.cpp:(.text+0x55): undefined reference to `cvWaitKey'
test.cpp:(.text+0x61): undefined reference to `cvReleaseImage'
test.cpp:(.text+0x6d): undefined reference to `cvDestroyWindow'
collect2: ld returned 1 exit status  


I googled the problem, and I found this:
http://www.cplusplus.com/forum/unices/2736/
But with that, I couldn't solve my problem.

I have the files in /usr/local/lib like it's discribed in the book.


Does anyone have an idea? How can I solve that problem?



Thank you for your help, guys.

Greez Tectu
My guess is that you are not specifying the library file when you run the g++ compiler.

Please post the exact g++ command line that you use.
Agreed, kspangsege.

If it is called libopencv.a or libopencv.so or something like that, then you should only need to add "-l opencv" to the end of your command line, where -l is the short option name for --library, the option used to link libraries.
Topic archived. No new replies allowed.