由于缺少"libgcc_s_dw2-1.dll",OpenCV程序无法运行.在Code :: Block中 [英] OpenCV program cannot run because of missing "libgcc_s_dw2-1.dll" in Code::Block
问题描述
我编写了一个简单的OpenCV程序,尝试在同一目录中打开图像"kindle-fire-hd.jpg". IDE是Code :: Block,版本OpenCV是2.4.2,编译器是MinGW,它是Code :: Block的组件.代码显示在这里:
I write a simple OpenCV program that tries to open an image "kindle-fire-hd.jpg" in the same directory. The IDE is Code::Block and the version OpenCV is 2.4.2 and the compiler is MinGW which is attached as the component of Code::Block. The code is shown here:
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat im = imread(argc == 2 ? argv[1] : "kindle-fire-hd.jpg", 1);
if (im.empty())
{
cout << "Cannot open image!" << endl;
return -1;
}
imshow("image", im);
waitKey(0);
return 0;
}
它可以正确地构建和编译(没有任何错误和警告消息),并且我已经按照
It can be built and compiled correctly (without any error and warning messages) and I have configured the Code::Block as that said in Getting started with OpenCV 2.4 and MinGW on Windows 7 .
但是,当我运行"该程序时.它显示缺少libgcc_s_dw2-1.dll"消息.
However, when I "run" this program. it shows a "missing libgcc_s_dw2-1.dll" message.
然后,当我单击确定"按钮时,控制台窗口将显示以下消息:
And, when I click the "OK" button, the console window shows the following message:
我尝试搜索关于stackoverflow的相关问题,但是所有问题的解决方案都无法解决此问题.谢谢.
I tried to search the related Questions on stackoverflow but all their solutions cannot fix this problem. Thanks.
推荐答案
最后,我解决了这个问题!
Finally, I fix this problem!
导致此缺少dll"问题的原因是与Code :: Block相连的MinGW编译器不完整.因此,您需要将所需的DLL文件下载到目录"C:\ Program Files(x86)\ CodeBlocks \ MinGW \ libexec \ gcc \ mingw32 \ 4.4.1",还需要将此目录的路径添加到系统PATH环境变量.
This reason that causes this "missing dll" problem is the MinGW compiler attached with the Code::Block is not complete. So, you need to download the required DLL files to the directory "C:\Program Files (x86)\CodeBlocks\MinGW\libexec\gcc\mingw32\4.4.1" which you also need to add the path of this directory to the system PATH environment variable.
在这种情况下,即使只有一个关于libgcc_s_dw2-1.dll的错误消息丢失,我也会下载两个DLL文件:libgcc_s_dw2-1.dll和libstdc ++-6.dll.如果您忘记第二个libstdc ++-6.dll,则在运行该程序时会收到另一条丢失的消息.
In this case, I download two DLL files: libgcc_s_dw2-1.dll and libstdc++-6.dll even if there is only one missing error message about libgcc_s_dw2-1.dll. If you forget the second one, libstdc++-6.dll, you will get another missing message when run the program.
第一个dll libgcc_s_dw2-1.dll可能会引起如下问题:
The first dll, libgcc_s_dw2-1.dll, can be fond at the question Where Can I Get libgcc_s_dw2-1.dll?, in which the download link is listed in the selected answer by the author rodrigo. Thanks the guy!
The second dll, libstdc++-6.dll, can be downloaded at http://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/gcc-4.6.2-1/libstdc%2B%2B-4.6.2-1-mingw32-dll-6.tar.lzma/download
这篇关于由于缺少"libgcc_s_dw2-1.dll",OpenCV程序无法运行.在Code :: Block中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!