1

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

Community
  • 1
  • 1
Rachit Vij
  • 23
  • 1
  • 4
  • Try removing the double quotes from the `-I` (and `-L`) value. – hmjd Sep 16 '12 at 11:05
  • those double quotes are for enclosing the path given. anyhow i did try ur suggestion. did not work – Rachit Vij Sep 17 '12 at 15:54
  • obviously highgui.hpp is missing or not detected as it's expected to be, I'd try to work this issue out. Check if it's included properly. New user hint - remember to return later and mark answer accepted if you consider one a good answer. – Piotr Wadas Sep 17 '12 at 23:59
  • i ve checked for the highgui.hpp file. its very much there. and i ve checked the path provided as well. so i m really just stuck. – Rachit Vij Sep 18 '12 at 17:58

2 Answers2

1

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.

0

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)

remi
  • 3,914
  • 1
  • 19
  • 37