在动态链接库libstdc ++-6.dll中找不到过程入口点__gxx_personality_v0

在动态链接库libstdc ++-6.dll中找不到过程入口点__gxx_personality_v0

问题描述:

尝试运行我的opencv应用程序时出现了该错误.我正在使用Windows7,CodeBlocks 12.11,opencv2.4.4和MinGW编译器(CodeBlocks中附带的一种).它编译并创建可执行文件,但是当我尝试运行该文件时,它会因过程入口错误而崩溃. 我已经将C:\ programs \ CodeBlocks \ Mingw \ bin添加到"PATH"变量中,并且我知道存在libstdc ++-6.dll.

I got that error when trying to run my opencv application. I´m using Windows7,CodeBlocks 12.11, opencv2.4.4 and MinGW compiler (the one that comes in CodeBlocks). It compiles and creates the executable but when i try to run it crashes with the procedure entry point error. I have added C:\programs\CodeBlocks\Mingw\bin to "PATH" variable and i know there is libstdc++-6.dll.

我不知道正在发生什么.

I don´t know what´s hapenning.

这是简单的代码:

include <iostream>
include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main()
{
cout << "Hello world!" << endl;
namedWindow("window");
Mat image=imread("mustang.jpg",CV_LOAD_IMAGE_COLOR);
imshow("window",image);
waitKey(0);
return 0;
} 

libstdc ++-6.dll包含运行时环境.它是基本例程的实现,例如堆管理器或异常处理.

The libstdc++-6.dll contains the runtime environment. It is an implementation of fundamental routines, such as the heap manager or the exception handling.

这些基本例程几乎在每个程序中都使用.因此,将它们的副本放入每个程序将浪费内存.这就是为什么它们通常打包到共享库(DLL)中的原因.然后,程序在需要运行时的例程时可以请求DLL.

These fundamental routines are used in nearly every program. Thus, it would be a waste of memory to put a copy of them into every program. That is why they are usually packed into a shared library (DLL). The programs can then request the DLL when they need the routines of the runtime.

在您的情况下,libstdc ++-6.dll包含错误版本的运行时.有两种可能性:

In your case, the libstdc++-6.dll contains a wrong version of the runtime. There are two possibilities:

  • 找到包含正确版本的运行时的libstdc ++-6.dll,并将其复制到可执行文件的目录中.您可以通过运行nm libstdc++-6.dll | grep personality来确定DLL是否正确.如果__gxx_personality_v0显示在列表中,则您可能具有正确的DLL.
  • 将运行时环境的副本放入可执行文件中.您可以通过在链接器参数中添加-static-libgcc -static-libstdc++来完成此操作.
  • Find a libstdc++-6.dll that contains the correct version of the runtime and copy it into the directory of your executable. You can determine whether a DLL is the correct one by running nm libstdc++-6.dll | grep personality. If the __gxx_personality_v0 shows up in the list, then you probably have the correct DLL.
  • Put a copy of the runtime environment into the executable. You can do this by adding -static-libgcc -static-libstdc++ to your linker parameters.