C++/mingw-gcc-g++ string declaration error

谁说胖子不能爱 提交于 2020-01-05 07:20:41

问题


I am using g++ to compile a very simple c++-program with

g++ main.cpp -o main.exe

My code:

#include <string>
int main() {
    std::string a;
    return 0;
}

[Windows 10 | mingw-gcc-g++ 6.3.0-1]

When I try to run the created main.exe, I get the exit code: 3221225785.
gdb returns:

(gdb) start
Temporary breakpoint 2 at 0x401464
Starting program: C:/[...]/main.exe
[New Thread 14272.0x1238]
[New Thread 14272.0x548c]
[New Thread 14272.0x42fc]
[New Thread 14272.0x3db4]
During startup program exited with code 0xc0000139.

I know that the error is caused by declaring the string in combination with g++. If I use clang++ to compile the code, everything works just fine. Does anyone know what exactly causes this error, how I could find out myself or even how to fix it?


I found this post, but if its possible somehow, I would prefer to not downgrade mingw-gcc-g++. The dependencywalker is not up to date and only returns false negatives as far as I know because it cannot handle MS API-sets.


[Edit] Small addendum:

I get the same error declaring a std::vector, std::set or std::map, but std::array for example works without problems. Do I use a deprecated library or something?

来源:https://stackoverflow.com/questions/48010955/c-mingw-gcc-g-string-declaration-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!