运行我的 C++ 代码给了我一个空白的控制台 [英] Running my C++ code gives me a blank console

查看:42
本文介绍了运行我的 C++ 代码给了我一个空白的控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Visual Studio 2015 中运行一些 C++ 代码.当我构建它时,我没有得到任何错误,但是一旦我运行它,我得到的只是一个空控制台.我不认为它冻结,因为我可以看到一个闪烁的下划线.此外,如果我在调试模式下运行它,Visual Studio 就会冻结.

I'm trying to run some C++ code in Visual Studio 2015. When I build it I get no errors, but once I run it, all I get is an empty console. I don't think it froze, because I can see a flashing underscore. Also if I run it in debug mode Visual Studio just freezes.

我使用了一个简单的hello world"代码:

I used a simple "hello world" code:

#include <iostream>
int main()
{
    std::cout << "hello world!
";
    return 0;
}

我尝试了什么:

我尝试重新安装 Visual Studio,但没有解决任何问题.我还尝试运行一些 Python 和 C# 代码,并且都没有问题.

I tried reinstalling Visual Studio, but it didn't fix anything. I also tried running some Python and C# code and both worked without problems.

推荐答案

注意:gcc/mingw/cygwin 用户也报告了这个问题.

您使用 Avast 防病毒软件吗?如果是这样,请尝试禁用它,然后测试您的程序.最近在 SO 上有几个类似的问题,Avast 就是问题所在.

Do you use Avast antivirus? If so, try disabling it and then test your program. There have been several similar questions on SO recently and Avast was the problem.

如果这解决了问题,我建议您为Visual Studio 2015Projects"目录添加排除项,而不是完全禁用防病​​毒软件.您还可以向 Avast 提交错误报告或尝试其他防病毒软件.

If that fixes the problem I suggest you add an exclusion for your "Visual Studio 2015Projects" directory instead of completely disabling your antivirus. You could also file a bug report with Avast or try a different antivirus.

这篇关于运行我的 C++ 代码给了我一个空白的控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆