What's the equivalent of gcc's -mwindows option in cmake?
Posted
by Runner
on Stack Overflow
See other posts from Stack Overflow
or by Runner
Published on 2010-05-02T07:44:35Z
Indexed on
2010/05/02
13:47 UTC
Read the original article
Hit count: 326
I'm following the tuto:
http://zetcode.com/tutorials/gtktutorial/firstprograms/
It works but each time I double click on the executable,there is a console which I don't want it there.
How do I get rid of that console?
I tried this:
add_executable(Cmd WIN32 cmd.c)
But got this fatal error:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
Cmd.exe : fatal error LNK1120: 1 unresolved externals
While using gcc directly works:
gcc -o Cmd cmd.c -mwindows ..
I'm guessing it has something to do with the entry function: int main( int argc, char *argv[])
,but why gcc works?
How can I make it work with cmake
?
UPDATE
Let me paste the source code here for convenience:
#include <gtk/gtk.h>
int main( int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return 0;
}
UPDATE2
Why gcc -mwindows
works but add_executable(Cmd WIN32 cmd.c)
not?
Maybe that's not the equivalent for -mwindows
in cmake?
© Stack Overflow or respective owner