0

I have the following program:

#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/imgproc/imgproc_c.h>

int main(int argc, char** argv) {

  return 0;

}

I run the following gcc command:

gcc -std=c99 -I/shared/sav/opt/include -I/shared/sav/opt/include/opencv -I/shared/sav/opt/include/opencv2 -I/shared/sav/Downloads/openCV-2.3.1/include -L/shared/sav/opt/lib -L/shared/sav/Downloads/openCV-2.3.1/build/lib -lopencv_highgui -lopencv_imgproc -lopencv_core -lm my_program.c -o my_program

and I have the following error messages:

/tmp/cczX8weZ.o: In function `cvDecRefData':
my_program.c:(.text+0xa68): undefined reference to `cvFree_'
/tmp/cczX8weZ.o: In function `cvGetRow':
my_program.c:(.text+0xbc0): undefined reference to `cvGetRows'
...

and other things like those above.

What is the cause of the problem and how can I solve it?

Saverio
  • 249
  • 3
  • 4
  • 10
  • What if you put all your libraries *after* your `.c` source file on the command line. – FatalError Oct 28 '15 at 16:28
  • 3
    I thinks it linker error, check here http://stackoverflow.com/questions/20483476/type-undefined-reference-to-cvfastfreevoid – Haris Oct 28 '15 at 16:29
  • Unfortunately none of the above comments help me to solve the problem. – Saverio Oct 28 '15 at 16:44
  • @Saverio According to this: http://stackoverflow.com/questions/20483476/type-undefined-reference-to-cvfastfreevoid , `The libraries have to be specified after the source file on the compiler/linker command line. (The linker keeps track of unresolved symbols, and resolves them via later command-line arguments.)` -- Seems like you're doing it the other way around ? – Morten Jensen Oct 28 '15 at 17:15

0 Answers0