Rachit Vij
Rachit Vij

Reputation: 23

Opencv 2.4.2 installation for C

I have been trying to install opencv for my windows 7 64bit. My basic aim is to use opencv in C language. I have both borland and mingw compilers. I used Getting started with OpenCV 2.4 and MinGW on Windows 7 guide exactly as described. But i keep getting the following response:

C:\Users\Rachit Dell\Pictures>g++ -I"C:\opencv\build\include" -L"C:\opencv\build
\x86\mingw\lib" loadimg.cpp -lopencv_core240 -lopencv_highgui240 -o loadimg
loadimg.cpp:1:39: error: opencv2/highgui/highgui.hpp: No such file or directory
loadimg.cpp:4: error: 'cv' is not a namespace-name
loadimg.cpp:4: error: expected namespace-name before ';' token
loadimg.cpp: In function 'int main(int, char**)':
loadimg.cpp:9: error: 'Mat' was not declared in this scope
loadimg.cpp:9: error: expected ';' before 'im'
loadimg.cpp:10: error: 'im' was not declared in this scope
loadimg.cpp:16: error: 'im' was not declared in this scope
loadimg.cpp:16: error: 'imshow' was not declared in this scope
loadimg.cpp:17: error: 'waitKey' was not declared in this scope

i have used version 2.4.2.

Could someone please guide me. I just need to setup an IDE to compile opencv in C.

Thanks

Upvotes: 1

Views: 861

Answers (2)

Barkan C. Erdogdu
Barkan C. Erdogdu

Reputation: 41

I thing I have faced with this error. You need to know if you wont use ffmpegs you can disable this setting before cmake phase. This property is valid most of speciality for opencv. I think you must solve your problem with it.

Otherwise, You can solve your problem by going to CMakeCache.txt that is created after your cmake process. You should adding path for some libs.

Upvotes: 1

remi
remi

Reputation: 3988

Do you have pkg-config installed in MinGW? try typing pkg-config --cflags --libs opencv in MinGW console. It should output some -I/c/opencv/build/include and -L/stuff. By the way I think the path should be entered in MinGW way not in standard Windows way. If pkg-config works, you can also compile your code using this command:

g++ loadimg.cpp -o loadimg `pkg-config --cflags --libs opencv`

(dont forget the backquotes)

Upvotes: 0

Related Questions