I am having difficulty running the following program:
#include <string>
#include <iostream>
using namespace std;
int main()
{
cout << "First line.";
string s = "Hello World";
cout << " After string.";
return 0;
}
It compiles fine, but produces no output when run.
If I comment out the string s = "Hello World";
line, then the program runs and outputs First Line. After string.
as expected.
It seems that whenever I try to declare a string, the program halts. This also happens when the string is inside a function which is not called.
I am building the program in VSCode on Windows and my compiler and version are: g++ (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0