How do I get rid of the console when writing GUI programs with gtk in C?

ε祈祈猫儿з 提交于 2019-12-07 08:54:59

问题


I'm following the tutorial:

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?

Platform: windows XP.

BTW I also have this trouble when right click on the icon:

GLib-WARNING **: g_main_context_check() called recursively from within a source's check() or prepare() member.

Is there anyone familiar with this?


回答1:


When you link, use the argument -mwindows

gcc -o simple simple.c `pkg-config --libs --cflags gtk+-2.0` -mwindows



回答2:


The console opens then an application outputs text (which perhaps was obvious). By default the application outputs text then an error occurs. Use g_set_printerr_handler() change that behaviour (into displaying an error dialog, writing to a file or whatever you want).



来源:https://stackoverflow.com/questions/2752479/how-do-i-get-rid-of-the-console-when-writing-gui-programs-with-gtk-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!