[英]OpenCV program compiles but doesn't run
I am working on Windows 8 with OpenCV 2.4.13 and MinGW 4.9. 我正在使用Windows 8和OpenCV 2.4.13和MinGW 4.9。
I wrote a simple and small opencv program to check if everything was installed properly. 我编写了一个简单的小型opencv程序来检查是否正确安装了所有程序。 Following is the code:
以下是代码:
#include <opencv2/highgui/highgui.hpp>
int main () {
printf("in main\n");
for (int i = 0; i<10; i++) {
printf("here\n");
IplImage * image = cvLoadImage("C:/{...}/test.jpg");
cvReleaseImage(&image);
}
return 0;
}
I compiled it with the following command at the command prompt: 我在命令提示符下使用以下命令对其进行了编译:
g++ -o test test.cpp -LC:\{...}\opencv\build\x64\vc11\lib -lopencv_core2413 -lopencv_highgui2413 -IC:\{...}\opencv\build\include
{...} is the path to the specified folder/file. {...}是指定文件夹/文件的路径。
This command runs properly and compilation is successful without any errors. 该命令可以正常运行,并且编译成功,没有任何错误。 However, when I run it with:
但是,当我用以下命令运行它时:
test
in main
and one here
gets printed after which I get the error message as 'test.exe has stopped working. in main
和一个here
被打印后,我收到错误消息,因为'test.exe已停止工作。 Windows is looking for a solution.' Windows正在寻找解决方案。”
What all I have tried: 我尝试过的一切:
Nothing is working for me at all. 什么都没有为我工作。 Please let me know if any more information is required.
请让我知道是否需要更多信息。 I'm desperately looking for a solution to this.
我正在拼命寻找解决方案。
对于那些可能遇到相同问题的人,我使用OpenCV动态( .dll
)库而不是.lib
文件编译了该程序,由于某种原因,它在运行时运行得很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.