1

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.

Sam Warren
  • 21
  • 2
  • 2
    I'd say that you should open an issue on https://github.com/cfyzium/bearlibterminal but don't have too high hopes. It has not been updated for years. – klutt Jul 24 '20 at 18:36
  • 2
    You can disable windows defender for some directories. – JCWasmx86 Jul 24 '20 at 18:37
  • What happens when you use a usual "hello, world!" program like `#include int main (void) {printf("hello world!";}` or just a foo program like `int main (void) {return 0;}`? Maybe it reacts to the terminal calls. – RobertS supports Monica Cellio Jul 24 '20 at 18:44
  • Can't you tell Windows Defender to leave the _specific_ program alone? – Paul Ogilvie Jul 24 '20 at 18:45
  • @RobertSsupportsMonicaCellio , a normal "hello world" world program also gives me the same issue. This is not something I expected, because like a week ago this didn't happen. – Sam Warren Jul 24 '20 at 18:54
  • And you didn't changed anything at WD in this week at all? Didn't installed any other tools regarding security? – RobertS supports Monica Cellio Jul 24 '20 at 18:59
  • @RobertSsupportsMonicaCellio not that I know of. I may have updated windows. Since my last response I've also uninstalled and reinstalled MinGW, no change. – Sam Warren Jul 24 '20 at 20:14

1 Answers1

0

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

Gertjan Brouwer
  • 996
  • 1
  • 12
  • 35