简体   繁体   English

mingw32:所有已编译的可执行文件都挂起

[英]mingw32: all compiled executables hang

I've just installed the most recent version of mingw32 and trying to compile even a hello world c++ program fails. 我刚刚安装了mingw32的最新版本,并试图编译一个hello world c ++程序失败。

Installation was in the default C:/MinGW directory. 安装位于默认的C:/ MinGW目录中。 I chose the option to install with mingw-get gui, and I selected the Basic Setup tab on the left-hand column, marked the mingw32-base and mingw32-gcc-g++ options for installation. 我选择了使用mingw-get gui进行安装的选项,并选择了左侧列中的Basic Setup选项卡,标记了mingw32-base和mingw32-gcc-g ++选项以进行安装。 Then I applied changes and downloaded all the files. 然后我应用了更改并下载了所有文件。 Lastly I added C:/MinGW/bin to the path of windows. 最后,我将C:/ MinGW / bin添加到了Windows的路径中。

Now I create a file that looks like this: 现在我创建一个如下所示的文件:

test.cpp: TEST.CPP:

#include <iostream>

int main() {
    std::cout << "hello world!" << std::endl;
    return 0;
}

and then I compile with g++ test.cpp 然后我用g++ test.cpp编译

Now, the problem is a bit harder to diagnose. 现在,问题有点难以诊断。 When I execute the output a.exe file, the command line simply hangs, no output, no return. 当我执行输出a.exe文件时,命令行只是挂起,没有输出,没有返回。 If I try and cancel execution with ctrl-c, nothing happens. 如果我尝试用ctrl-c取消执行,则没有任何反应。 When I forcefully exit out of the command line, and try to delete a.exe, windows tells me the executable is currently opened by system, and the only way to forcefully remove the file is with FileASSASSIN. 当我强行退出命令行,并尝试删除a.exe时,Windows告诉我系统当前打开了可执行文件,强行删除文件的唯一方法是使用FileASSASSIN。

Some notes, I have visual studio 12 installed, but nothing pertaining to it in the path. 有些笔记,我安装了visual studio 12,但在路径上没有任何相关内容。 I had a previous installation of cygwin64 but it has been removed entirely. 我之前安装了cygwin64,但它已被完全删除。 I get the same behavior running it from powershell, normal command line, or Console2. 我从powershell,普通命令行或Console2运行它的行为相同。 Google suggested I try statically linking libstdc++ with -static-libstdc++ to no avail. 谷歌建议我尝试静态链接libstdc ++与-static-libstdc++无济于事。

Also, when compiled with debugging symbols and then ran with gdb a.exe , and then you run start, it also hangs just the same. 另外,当使用调试符号编译然后使用gdb a.exe运行,然后运行start时,它也会挂起相同的内容。

I'm out of ideas on getting information for troubleshooting here. 我没有在这里获取故障排除信息的想法。 Does anyone have any insight? 有没有人有任何见解?

On the suggestion of @MM, I discovered that avast antivirus was the silent cause of halting any executables made by mingw32. 根据@MM的建议,我发现avast防病毒是暂停mingw32所做的任何可执行文件的沉默原因。 This was puzzling, because I was running executables made by visual studio on command line only a few hours ago. 这令人费解,因为我几个小时前才在命令行上运行visual studio制作的可执行文件。

The lesson: If you encounter unexpected behavior, always try your antivirus. 课程:如果遇到意外行为,请始终尝试使用防病毒软件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM