c++ - 使用 std::string 导致 Windows "Entry Point Not Found"

标签 c++ windows gcc windows-8 runtime-error

<分区>

当我用 G.C.C. 编译它时:

#include <iostream>
#include <string>

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

通过使用以下批处理:

g++ -Wall main.cc

并尝试执行输出(a.exe),然后 Windows 因以下错误使初始化崩溃:

Run time error

如果我避免使用 std::string在 C++ 代码中它正常执行,甚至包括 <string> .有什么想法吗?

注意,第一次测试std::string .

我运行 Windows 8/64 位。我的编译器包含此文件 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)。

最佳答案

很难找到解决方案 (zZZzzZzZzZz),但最终,它在 this answer 上.

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

关于c++ - 使用 std::string 导致 Windows "Entry Point Not Found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44573802/

相关文章:

c - MicroFocus cobol 命令 cobinit、cobcall 和 cobtidy 在我的 C 程序中抛出错误

gcc - 为什么链接库的顺序有时会导致 GCC 出错?

c++ - 使用 GCC 强制执行显式(直接)#include 语句

c++ - OpenGL "black screen"挫折

windows - 确定我的代码当前运行在哪个物理处理器上

java - 无法运行用户服务。异常 : Failed to start Java, ServiceStart 返回 4

windows - Heroku Toolbelt Windows - Rails 控制台命令历史记录

c++ - boost::extension.hpp的原因未为无序容器和其他一些容器定义hash_value()

C++:如何在 main() 退出后打印一些文本?

c++ - static const 与 const static