OpenCV error

hello all,

I have been coding in python before and included the library of openCV without any problem. Now, I want to code in C++ so I downloaded eclipse and openCV libraries and included their path in the includes from eclipse ..

I have simple example of openCV and I am trying to run it, but I get this error -->

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**** Build of configuration Debug for project Example ****

make all 
Building file: ../Test.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Test.d" -MT"Test.d" -o "Test.o" "../Test.cpp"
Finished building: ../Test.cpp
 
Building target: Example
Invoking: GCC C++ Linker
g++  -o "Example"  ./Test.o   
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
./Test.o: In function `gh::main()':
/home/shamma/workspace/Example/Debug/../Test.cpp:16: undefined reference to `cvCreateImage'
/home/shamma/workspace/Example/Debug/../Test.cpp:21: undefined reference to `cvNamedWindow'
/home/shamma/workspace/Example/Debug/../Test.cpp:22: undefined reference to `cvShowImage'
/home/shamma/workspace/Example/Debug/../Test.cpp:23: undefined reference to `cvWaitKey'
/home/shamma/workspace/Example/Debug/../Test.cpp:24: undefined reference to `cvDestroyWindow'
/home/shamma/workspace/Example/Debug/../Test.cpp:25: undefined reference to `cvReleaseImage'
collect2: ld returned 1 exit status
make: *** [Example] Error 1

 


any idea what might be the cause of the problem, I have tried lots of things without use

thanks in advance
For those errors I would check if you're linking correctly the library, maybe you included the include folder, but you need to link the dlls too.
If you're new to C++ you may not know this, but in C++ the general practice is to separate the declarations and definitions of functions and datatypes and the like. Besides including header files, you also have to link to a library containing the appropitiate definitions.

http://en.wikipedia.org/wiki/Linker_%28computing%29
Last edited on
Topic archived. No new replies allowed.