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

4
  • Try removing the double quotes from the -I (and -L) value. Commented Sep 16, 2012 at 11:05
  • those double quotes are for enclosing the path given. anyhow i did try ur suggestion. did not work Commented Sep 17, 2012 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. Commented Sep 17, 2012 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. Commented Sep 18, 2012 at 17:58

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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)

2 Comments

output: g++: 'pkg-config':no such file or directory g++: opencv:no such file or directory
did you copy paste the command line? with the backquotes ``````

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.