The procedure entry point _ZNSt7_cxx1112basic_stri

2019-02-20 06:24发布

问题:

I am having immense difficulty trying to use std::string. The program compiles absolutely fine, but when I run the program, I receive this error: error

I have looked everywhere on google and haven't found a thing on how to solve this issue. I have also tried writing my code differently to see if that would tell me anything.

std::string yourName;
std::cout << "What is your name?";
std::cin >> yourName;
std::cout << "Hello, " << yourName << std::endl;

Despite the rewrite, I am still getting the same exact error, and I am not forgetting to include the iostream and string header files.

I am using the GCC compiler and my compile code is g++ -std=c++14 test.cpp -o test.exe. I have also tried using the compile code g++ test.cpp -o test.exe. This did not fix the error.

I have asked this question before on Stack Overflow, but I failed to get a clear and understandable answer, most likely due to the fact that I am a complete beginner in programming. That being said, can someone please give me an answer on what might be causing this problem and how to fix it in plain English?

回答1:

I downloaded GCC from this link: Source Forge and reinstalled GCC. My problems were successfully fixed.



回答2:

You can use

g++ <file> -static-libstdc++ -static-libgcc

I had the same problem, but it worked for me