Suppose we open a cmd window and enter into the Mingw bin directory to build a hello world program in another directory:
cd c:mingwbin
g++ -o c:testapp.exe c:testapp.cpp
The compiling is ok and app.exe is successfully generated, but when running it, the system pops up a windows saying:
This app can't run on your PC
To find a version for your PC, check with the software publisher.
And there is a message “Access is denied” in the cmd window. The error persists if I copy app.exe from C:test to C:mingwbin and run it. If I copy the source code app.cpp from C:test to C:mingwbin and compile it, the built app.exe can be run without a problem. Why?
The source code(app.cpp) is very simple:
#include <stdio.h>
int main()
{
printf("hello world");
return 0;
}