I am using the gcc compiler that comes with minGW on Windows 10. When I try to compile a simple hello world program named hello.cpp
#include <iostream>
#include <string>
std::string x = "hello world";
int main() { std::cout << x << std::endl; }
when I compile it with the command g++ test.cpp -o test it compiles fine, but when I try running the exe, I get the following error popup.
the procedure entry point _znkst7__cxx1112basic_stringlcst11char_traitslcESalcEEC1EPKcRKS3_ could not be located in the dynamic link library C:\mingw_dev_lib\test.exe
I've added minGW to my path as tutorials instructed, and can compile and run a version of the hello world program that doesn't use the string library (but still uses iostream) just fine. googling around it seems that some people with similar problems sorted it out by reinstalling minGW, but I reinstalled minGW and recompiled the hello world program and had same issue. Any ideas on what is going wrong?