【问题标题】:using the standard input stream leads to compilation failure [duplicate]使用标准输入流导致编译失败[重复]
【发布时间】:2015-12-21 15:52:12
【问题描述】:

运行简单的 c++ 程序(例如 HelloWorld)没有问题,但是当我在代码中使用 cin 时,我看到以下错误

过程入口点 __gxx_personality_v0 无法位于 动态链接库 C:\Users\username\Desktop\helloworld.exe

我使用 MinGW 编译器,Windows 10 上的 sublime 文本


代码:

#include <iostream>

using namespace std;

int main()
{
    int x = 1;
    cin >> x;
    cout << x << endl;
    return 0;
}

【问题讨论】:

  • 由于你没有包含任何代码,我不得不查阅我的水晶球,它说错误在第 42 行。占卜板说可能有 c 或 @ 987654323@在文件名的扩展名中。
  • @JerryCoffin 水晶球从不撒谎。
  • 如果你真的运行你的程序得到错误,这不是编译器错误。在这种情况下也不是链接器错误。
  • 这是我的代码 #include using namespace std; int main() { int x = 1;辛 >> x; cout

标签: c++ c++11 mingw


【解决方案1】:

来自 gcc 邮件列表中的此存档https://gcc.gnu.org/ml/gcc-help/2002-07/msg00186.html

__gxx_personality_v0 是定义的 G++ 异常处理模型的一部分 通过 GCC 中的新 C++ ABI。该符号由libstdc++ 提供 库,由g++添加到链接行。

所以,在这种情况下,我很确定您使用了mingw-gcc 来编译您的代码。切换到mingw-g++ 或将-lstdc++ 添加到您的命令中即可完成工作。

【讨论】:

  • 我用这个命令运行cpp文件g++ helloworld.cpp -o helloworld.exe
猜你喜欢
  • 2022-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-06
  • 2018-09-16
  • 1970-01-01
相关资源
最近更新 更多