Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 135

Could not compile a simple C demo program.

$
0
0
I installed opencv via `pacman -S mingw-w64-i686-opencv` in my MSYS2. Then I wrote a simple c demo program. #include #include int main() { IplImage* img = cvLoadImage("a4-paper.jpg"); cvShowImage("test",img); cvWaitKey(0); return 0; } I compiled it with gcc `pkg-config --cflags opencv` -o opencv_demo opencv_demo.c `pkg-config --libs opencv` The output was Liu.D.H@desktop-ldh MINGW32 /c/Users/Liu.D.H/Desktop/helloC$ gcc `pkg-config --cflags opencv` -o opencv_demo opencv_demo.c `pkg-config --libs opencv` In file included from C:/msys32/mingw32/include/opencv2/core/core_c.h:48:0, from C:/msys32/mingw32/include/opencv/cv.h:63, from opencv_demo.c:1: C:/msys32/mingw32/include/opencv2/highgui/highgui_c.h:139:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token CVAPI(cv::Rect)cvGetWindowImageRect(const char* name); ^ opencv_demo.c: In function 'main': opencv_demo.c:5:21: warning: implicit declaration of function 'cvLoadImage'; did you mean 'cvShowImage'? [-Wimplicit-function-declaration] IplImage* img = cvLoadImage("a4-paper.jpg"); ^~~~~~~~~~~ cvShowImage opencv_demo.c:5:21: warning: initialization makes pointer from integer without a cast [-Wint-conversion] Liu.D.H@desktop-ldh MINGW32 /c/Users/Liu.D.H/Desktop/helloC$

Viewing all articles
Browse latest Browse all 135

Trending Articles