I\'m using MinGW to build my application on Windows. When compiling and linking, the option \"-mwindows\" is put in command line to have Win32 API functions.
To be more
I have no evidence for this answer, only a bit of experiments that were successful. If I have a hello app, like this:
#include
#include
int main(void)
{
puts("hi");
MessageBox(NULL, "test", "test", NULL);
GetStockObject(0);
return 0;
}
I cannot compile it with -mconsole
, because linker complains about GetStockObject
. But when I add the necessary library with -lgdi32
switch on my command line, the app compiles and executes cleanly. Maybe this is the way to keep both console and gdi. This is the command line:
gcc -mconsole test_gdi.c -lgdi32