common-cv icon indicating copy to clipboard operation
common-cv copied to clipboard

cannot compile C codes

Open t-cool opened this issue 7 years ago • 1 comments

Hi, I'm trying to compile C codes inside C directory, but I cannot... Could you tell me which part to fix in makefile?

$ make
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o IplImage.o IplImage.c
In file included from IplImage.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/highgui.h:45:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
1 warning generated.
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o filter.o filter.c
In file included from filter.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/cv.h:63:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
filter.c:47:3: warning: implicit declaration of function
      'cvCvtPixToPlane' is invalid in C99
      [-Wimplicit-function-declaration]
  cvCvtPixToPlane(src, dst0,dst1,dst2,dst3);
  ^
2 warnings generated.
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o draw.o draw.c
In file included from draw.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/highgui.h:45:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
1 warning generated.
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o imageproc.o imageproc.c
In file included from imageproc.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/highgui.h:45:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
1 warning generated.
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o hist.o hist.c
In file included from hist.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/cv.h:63:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
hist.c:6:10: warning: implicit declaration of function
      'cvQueryHistValue_1D' is invalid in C99
      [-Wimplicit-function-declaration]
  return cvQueryHistValue_1D(hist, idx0);
         ^
hist.c:10:10: warning: implicit declaration of function
      'cvQueryHistValue_2D' is invalid in C99
      [-Wimplicit-function-declaration]
  return cvQueryHistValue_2D(hist, idx0, idx1);
         ^
hist.c:14:10: warning: implicit declaration of function
      'cvQueryHistValue_3D' is invalid in C99
      [-Wimplicit-function-declaration]
  return cvQueryHistValue_3D(hist, idx0, idx1, idx2);
         ^
hist.c:18:10: warning: implicit declaration of function
      'cvQueryHistValue_nD' is invalid in C99
      [-Wimplicit-function-declaration]
  return cvQueryHistValue_nD(hist, idx);
         ^
5 warnings generated.
cc `pkg-config --cflags opencv` -std=c99 -fPIC   -c -o contours.o contours.c
In file included from contours.c:2:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv/cv.h:63:
In file included from /usr/local/Cellar/opencv/3.3.1/include/opencv2/core/core_c.h:48:
/usr/local/Cellar/opencv/3.3.1/include/opencv2/core/types_c.h:929:13: warning: 
      implicit declaration of function 'cvRound' is invalid in C99
      [-Wimplicit-function-declaration]
    ipt.x = cvRound(point.x);
            ^
1 warning generated.
cc -shared -o libopencv_wrap IplImage.o filter.o draw.o imageproc.o hist.o contours.o `pkg-config --libs opencv`
ld: library not found for -llibopencv_stitching.3.3.1.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libopencv_wrap] Error 1
$ 

t-cool avatar Nov 19 '17 07:11 t-cool

most are warnings, the last one is the one of the error. It just means that you don't have that particular part of opencv's shared library installed or it can't find it, worst case might be you can just copy the library to the CWD

azimut avatar Jun 22 '18 18:06 azimut