开发者

Compiling simple gtk+ application

I try to compile simple gtk+ application in Anjuta IDE. Application is a simple window:

# include <gtk/gtk.h>

int main( int argc, char *argv[])
{
    GtkWidget *label;   
    GtkWidget *window;  
    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Здравствуй, мир!");
    label = gtk_label_new("Здравствуй, мир!");
    gtk_container_add(GTK_CONTAINER(window), label);
    gtk_widget_show_all(window);
    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
    gtk_main();
    return 0;
}

In make file i have:

GTK_CFLAGS = -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1  

GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0  

But i see error, when i try to compile project: gtk/gtk.h - No such file开发者_StackOverflow社区 or directory

Thank you.


On linux under terminal with no make file

     gcc -o project project.cpp -Wall `pkg-config --libs --cflags gtk+-2.0`

replace project with whatever your file is name

and replace gtk+-2.0 with whatever version your using its simple and

make files are uneeded for such a small program :P goodluck


In Anjuta, you can choose Properties from the Project menu, then go to the Packages tab. There will be a list of modules and packages. Add the package gtk+-2.0 to whatever module is in the list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜