简体   繁体   English

Windows Defender/Security 删除了我的“hello world”程序

[英]Windows Defender/Security deletes my “hello world” program

I'm trying to start a new C project using BearLibTerminal , compiling with gcc.我正在尝试使用 BearLibTerminal 启动一个新的 C 项目,并使用gcc进行编译。

I'm able to compile the hello world, but when I try to launch, Windows Security gives an error, which reads我能够编译 hello world,但是当我尝试启动时,Windows Security 给出了一个错误,上面写着

"Operation did not complete successfully because the file contains a virus or potentially unwanted software." “操作未成功完成,因为该文件包含病毒或可能不需要的软件。”

Shortly after compilation, whether I attempt to run or not Windows deletes the executable.编译后不久,无论我是否尝试运行 Windows 都会删除可执行文件。

I can of course disable Windows Security real-time protection, but this seems like a bad workaround.我当然可以禁用 Windows 安全实时保护,但这似乎是一个糟糕的解决方法。 Does anyone know what could be changed so that Windows doesn't think my program is a virus?有谁知道可以改变什么,以便 Windows 不认为我的程序是病毒?

Here is the code:这是代码:

#include "BearLibTerminal.h"

int main()
{
    terminal_open();
    
    // Printing text
    terminal_print(1, 1, "Hello, world!");
    terminal_refresh();
    
    // Wait until user close the window
    while (terminal_read() != TK_CLOSE);
    
    terminal_close();
}

and this is the makefile:这是 makefile:

gcc -IC:/foo/include -LC:/foo/bin main.c -lBearLibTerminal -o test.exe

Thanks kindly for the assistance.感谢您的帮助。

EDIT: I seem to have fixed the problem.编辑:我似乎已经解决了这个问题。 For some reason, the version of MinGW found here , which is where I was directed to from mingw.org, causes things I compile to be detected as a virus.出于某种原因,在此处找到的 MinGW 版本(我从 mingw.org 被定向到的位置)导致我编译的内容被检测为病毒。 I removed MinGW completely, and downloaded the version found on SourceForge, and I no longer have the issue.我完全删除了 MinGW,并下载了在 SourceForge 上找到的版本,我不再有这个问题。 I have no idea if the compiler was somehow compromised, or if Windows Security was just looking out for things made by a specific version of MinGW, but I would note that the version of "Hello World" from the first compiler was 4kb larger than the version from the SourceForge compiler, and likewise the installer was around 6kb larger too.我不知道编译器是否以某种方式受到损害,或者 Windows Security 是否只是在寻找特定版本的 MinGW 所做的事情,但我会注意到第一个编译器的“Hello World”版本比SourceForge 编译器的版本,同样安装程序也大了大约 6kb。

As a temporary fix you can exclude your compilation folder from Windows Defender.作为临时修复,您可以从 Windows Defender 中排除您的编译文件夹。

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

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