Simple OpenCV program won't run; given no errors. What now?
I'm working on a term project for school and plan to use OpenCV. I've spent the past day or so battling include/link errors (mostly because of dumb mistakes) and finally have everything working. Or so I thought.
I have a simple program, that looks like this:
#include <highgui.h>
int main() {
cvNamedWindow("window", CV_WINDOW_AUTOSIZE);
cvWaitKey(0);
return 0;
}
No errors appear in Eclipse, and everything is bold-faced / looking as it should for the library functions (can't remember exactly what the proper formatting name is called). When I compile it, everything succeeds. No errors. But when I run this, nothing happens. And it's at this point I'm stuck.
I'm using OpenCV at work and modeled my setup at home accordingly (nearl开发者_高级运维y identically actually). The include paths, library paths, and libraries are added properly in the project for Eclipse (at least, w.r.t my work setup). The DLL's are in the same folder as the executable.
Any ideas why this doesn't run? (The window doesn't display, it just instantly terminates)
I should mention that I'm using Eclipse (Helios), MinGW, Windows 7, and OpenCV 2.3.
Cheers.
Try compiling from command prompt, than run executable from command prompt, see what happens. this is how I compile
g++ -o main.exe main.cpp -I"C:\OpenCV2.1\include\opencv" -L"C:\OpenCV2.1\lib" -lcxcore210 -lcv210 -lhighgui210 -lcvaux210 -lml210
Note: that i have used opencv 2.1. so set your one accordingly. And also I have added OpenCv bin folder to path
, so it makes it easier to find the dll files for the executable file.
精彩评论