Hi, I'm having trouble compiling a C code using OpenCV library, this is my main.c file.
#include <opencv/cv.h>
int main()
{
CvCapture* webcam = cvCreateCameraCapture(0);
return 0;
}
This is the error I get when I compile the program with gcc
$ gcc main.c
main.c: In function ‘main’:
main.c:5:5: error: unknown type name ‘CvCapture’; did you mean ‘CvCmpFunc’?
CvCapture* webcam = cvCreateCameraCapture(0);
^~~~~~~~~
CvCmpFunc
main.c:5:25: warning: implicit declaration of function ‘cvCreateCameraCapture’; did you mean ‘cvCreateGraph’? [-Wimplicit-function-declaration]
CvCapture* webcam = cvCreateCameraCapture(0);
^~~~~~~~~~~~~~~~~~~~~
cvCreateGraph
main.c:5:25: warning: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
It doesn't recognize the typedef struct CvCapture
even though I included opencv/cv.h
.
Here's the documentation I referenced for cvCreateCameraCapture(): https://docs.opencv.org/3.4/dd/d01/group__videoio__c.html
I installed the OpenCV library using Pamac Manager, so the header files are in /usr/include/opencv/
and shared object files are in /usr/lib/
.
Any help is appreciated!