我在root下建了一个ourgtk文件夹,然后在里面写了一个书上的示例程序,在终端make却有错误。
base.c源程序如下:
#include <gtk/gtk.h>
int main( int argc, char * argv[])
{
GtkWidget * window;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDIW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return FALSE;
}
makefile内容如下:
CC = gcc
all:
$(CC) -o base base.c 'pkg-config --cflags --libs gtk+-2.0'
终端给出的错误是:
gcc -o base base.c 'pkg-config --cflags --libs gtk+-2.0'
gcc: pkg-config --cflags --libs gtk+-2.0: 没有那个文件或目录
base.c:1:21: gtk/gtk.h: 没有那个文件或目录
base.c: In function `main':
base.c:4: `GtkWidget' undeclared (first use in this function)
base.c:4: (Each undeclared identifier is reported only once
base.c:4: for each function it appears in.)
base.c:4: `window' undeclared (first use in this function)
base.c:6: `GTK_WINDIW_TOPLEVEL' undeclared (first use in this function)
base.c:9: `FALSE' undeclared (first use in this function)
make: *** [all] Error 1
但是我有pkg-config在/usr/bin中
也有gtk/gtk.h在/usr/include/gtk-2.0/gtk中