0

Running simple c++ program (e.g. HelloWorld) has no problem, but when I use cin in my code, I see the following error

procedure entry point __gxx_personality_v0 could not be located in the dynamic link library C:\Users\username\Desktop\helloworld.exe

I use MinGW compiler, sublime text on windows 10


Code:

#include <iostream>

using namespace std;

int main()
{
    int x = 1;
    cin >> x;
    cout << x << endl;
    return 0;
}
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • 4
    Since you haven't included any code, I'm forced to consult my crystal ball, which says the error is on line 42. The Ouija board says there's probably either a `c` or an `h` in the extension of the file name. – Jerry Coffin Dec 21 '15 at 15:54
  • 1
    @JerryCoffin Crystal balls never lie. – Hatted Rooster Dec 21 '15 at 15:55
  • If you actually *run* your program to get the error, it's not a compiler error. It's not a linker error either in that case. – Some programmer dude Dec 21 '15 at 15:55
  • Here's my code #include using namespace std; int main() { int x = 1; cin >> x; cout << x << endl; return 0; } –  Dec 21 '15 at 16:21

1 Answers1

0

From this archive in gcc mailing list https://gcc.gnu.org/ml/gcc-help/2002-07/msg00186.html,

__gxx_personality_v0 is part of the G++ exception handling model defined by the new C++ ABI in GCC. The symbol is provided by the libstdc++ library, which is added to the link line by g++.

So, in this case, I'm pretty sure that you used mingw-gcc to compile your code. Switch to mingw-g++ or add -lstdc++ to your command will make the job done.

Danh
  • 5,916
  • 7
  • 30
  • 45
  • I use this command to run cpp file g++ helloworld.cpp -o helloworld.exe –  Dec 21 '15 at 16:18