0

I'm trying to compile an application that uses a string but I don't get the expected result and I receive no error from the compiler. It only happens when I create a string, so if I remove the line that creates a string and cout plain text it works correctly.

The code is as follows:

#include <string>
#include <iostream>

int main()
{
    std::string myString = "Hello, this is a string";
    std::cout << myString;
    return 0;
}

I then run g++ test.cpp -o test and then ./test.exe and nothing displays on the screen, it just hangs when I expected "Hello, this is a string" to appear. What am I doing wrong..?

Edit: I've disabled avast and the problem still persists.

user1157885
  • 1,999
  • 3
  • 23
  • 38

0 Answers0