C ++字符串不在控制台中显示

时间:2016-01-10 20:31:42

标签: c++

我正在尝试编译使用字符串的应用程序,但是我没有得到预期的结果,并且我没有收到编译器的错误。它只在我创建一个字符串时发生,所以如果我删除创建字符串和cout纯文本的行,它就能正常工作。

代码如下:

#include <string>
#include <iostream>

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

然后我运行g ++ test.cpp -o test然后运行./test.exe并且屏幕上没有显示任何内容,它只是在我预期“Hello,this is a string”出现时挂起。我做错了什么..?

修改 我已经禁用了avast,问题仍然存在。

0 个答案:

没有答案
相关问题