'The procedure entry point _ZNSt7_cxx1112basic_stringlcSt11char_traitslcESalcEEC1Ev could not be located in the dynamic link library

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?



Solution 1:[1]

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

Solution 2:[2]

You can use

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

I had the same problem, but it worked for me

Solution 3:[3]

Just download and reinstall latest GCC, I got it from here version : 11.2.0 https://techdecodetutorials.com/downloads/mingw.exe

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 McGrizz
Solution 2 Natchuz
Solution 3 asrt74