I'm using Visual Studio 2019 (Community Edition). I've never had an issue when compiling C++ code. I simply get the final executable and I'm able to run it without a problem. Recently I've decided to learn C and this is the C program that I'm compiling:
#include <stdio.h>
int main()
{
printf("Hello, world! \n");
return 0;
}
The file name is "main.c".
I haven't changed any of the default project settings and the project that I selected was "empty C/C++ project".
The code compiles fine but when I attempt to run the executable I get this error:
Unable to start program [path to .exe file]
Operation did not complete successfully because the file contains a virus or potentially unwanted software.
I can resolve this issue by going to Windows Defender and manually allowing this detected threat but obviously the issue with this approach is that other people won't be able to run my C programs without them being detected as a virus.
Ultimately, I believe this problem is related to how VS2019 is compiling my program rather than Windows Defender because I'm able to compile C++ (and other languages) into executables that run perfectly fine.