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

杀马特。学长 韩版系。学妹 提交于 2019-12-01 11:20:12

问题


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:


You can use

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

I had the same problem, but it worked for me




回答2:


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



来源:https://stackoverflow.com/questions/42738610/the-procedure-entry-point-znst7-cxx1112basic-stringlcst11char-traitslcesalceec1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!