c++ - No display for GTK in Visual Studio 2015 -
after couple of rounds of troubleshooting able compile gtk source code in visual studio no errors. followed procedure not dissimilar 'how configure gtk on visual studio 2010'. code follows,
#include <gtk-2.0\gtk\gtk.h> #pragma comment(linker, "/subsystem:windows /entry:maincrtstartup") int main(int argc, char* argv[]) { gtkwidget* window = gtk_window_new(gtk_window_toplevel); gtk_init(&argc, &argv); gtk_widget_set_usize(window, 300, 200); g_signal_connect(g_object(window), "destroy", g_callback(gtk_main_quit), null); gtk_window_set_title(gtk_window(window), "gtk+ vs2010"); gtk_widget_show(window); gtk_main(); return 0; }
however on starting code no window appears. visual studio indicates solution running no window appears. ideas?
there's problem here:
gtkwidget* window = gtk_window_new(gtk_window_toplevel); gtk_init(&argc, &argv);
you should call gtk_init
before creating windows:
call function before using other gtk+ functions in gui applications. initialize needed operate toolkit , parses standard command line options.
try:
gtk_init(&argc, &argv); gtkwidget* window = gtk_window_new(gtk_window_toplevel);
Comments
Post a Comment