使用 std::string 会导致 Windows“未找到入口点" [英] Using std::string causes Windows "Entry Point Not Found"
问题描述
当我用 G.C.C. 编译时:
When I compile this with G.C.C.:
#include <iostream>
#include <string>
int main()
{
std::cout << std::string("\r\n");
return 0;
}
通过使用以下批次:
g++ -Wall main.cc
并尝试执行输出 (a.exe
),然后 Windows 因此错误而导致初始化崩溃:
And attempt executing the output (a.exe
), then Windows crashes the initialization with this error:
如果我避免在 C++ 代码中使用 std::string
,它会正常执行,甚至包括
.有什么想法吗?
If I avoid using std::string
in the C++ code it executes normally, even including <string>
. Any ideas?
注意,第一次测试std::string
.
我运行的是 Windows 8/64 位.我的编译器包含这个文件 build-info.txt
:
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...]
# **************************************************************************
另请注意,我习惯于禁用和卸载所有可能的防病毒实用程序(例如,Windows Defender).
Also note that I'm used to disable and uninstall all possible anti-virus utilities (e.g., Windows Defender).
推荐答案
很难找到解决方案 (zZZzzZzZzZz),但终于在 这个答案.
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
这篇关于使用 std::string 会导致 Windows“未找到入口点"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!