Sam Warren
Sam Warren

Reputation: 21

Windows Defender/Security deletes my "hello world" program

I'm trying to start a new C project using BearLibTerminal, compiling with gcc.

I'm able to compile the hello world, but when I try to launch, Windows Security gives an error, which reads

"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.

I can of course disable Windows Security real-time protection, but this seems like a bad workaround. Does anyone know what could be changed so that Windows doesn't think my program is a virus?

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:

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. I removed MinGW completely, and downloaded the version found on SourceForge, and I no longer have the issue. 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.

Upvotes: 1

Views: 781

Answers (1)

Gertjan Brouwer
Gertjan Brouwer

Reputation: 1016

As a temporary fix you can exclude your compilation folder from Windows Defender.

Upvotes: 0

Related Questions