Using std::string causes Windows “Entry Point Not Found” [duplicate]

ぃ、小莉子 提交于 2021-02-07 13:58:17

问题


When I compile this with G.C.C.:

#include <iostream>
#include <string>

int main()
{
    std::cout << std::string("\r\n");
    return 0;
}

By using the following batch:

g++ -Wall main.cc

And attempt executing the output (a.exe), then Windows crashes the initialization with this error:

If I avoid using std::string in the C++ code it executes normally, even including <string>. Any ideas?

Note, first time testing std::string.

I run Windows 8 / 64 bits. My compiler includes this file build-info.txt:

# **************************************************************************

version : MinGW-W64-builds-4.3.0
user    : nixman
date    : 03.30.2017- 1:01:08 PM
args    : --mode=gcc-6.3.0 --buildroot=/c/mingw630 --jobs=2 --rev=2 --threads=win32 --exceptions=sjlj --arch=i686 --bin-compress

[much more here...]

# **************************************************************************

Also note that I'm used to disable and uninstall all possible anti-virus utilities (e.g., Windows Defender).


回答1:


It was hard to find a solution (zZZzzZzZzZz), but finally, it's on this answer.

g++ -Wall -D_GLIBCXX_USE_CXX11_ABI=0 main.cc


来源:https://stackoverflow.com/questions/44573802/using-stdstring-causes-windows-entry-point-not-found

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