2009-07-13 48 views
2

我正在尝试关注第0123.2节,从this manual开始。此命令然而,正如我已经配置我的目标是DIABLO_ARMEL而非DIABLO_X86,我已经得到了不同的结果:maemo scratchbox编译器错误,gtk + -2.0

[sbox-DIABLO_X86: ~] > gcc -Wall -g gtk_helloworld-1.c \ 
‘pkg-config --cflags gtk+-2.0‘ -o gtk_helloworld-1 \ 
‘pkg-config --libs gtk+-2.0‘ 
[sbox-DIABLO_X86: ~] > 

我已经进入这行之前,检查单引号中的命令的CFLAGS和库的结果,以及示例中描述的内容和我在命令窗口中看到的内容之间的结果。

无论如何,我预计不会有错误信息在终端弹出,但我得到了以下几点:

[sbox-DIABLO_ARMEL: ~] > gcc -Wall -g gtk-helloworld-1.c \ 
> 'pkg-config --cflags gtk+-2.0' -o gtk_helloworld-1 \ 
> 'pkg-config --libs gtk+-2.0' 
sbox-arm-linux-gcc: pkg-config --cflags gtk+-2.0: No such file or directory 
sbox-arm-linux-gcc: pkg-config --libs gtk+-2.0: No such file or directory 
gtk-helloworld-1.c:15:21: gtk/gtk.h: No such file or directory 
gtk-helloworld-1.c: In function `main': 
gtk-helloworld-1.c:20: error: `GtkWindow' undeclared (first use in this function) 
gtk-helloworld-1.c:20: error: (Each undeclared identifier is reported only once 
gtk-helloworld-1.c:20: error: for each function it appears in.) 
gtk-helloworld-1.c:20: error: `window' undeclared (first use in this function) 
gtk-helloworld-1.c:21: error: `GtkLabel' undeclared (first use in this function) 
gtk-helloworld-1.c:21: error: `label' undeclared (first use in this function) 
gtk-helloworld-1.c:24: warning: implicit declaration of function `gtk_init' 
gtk-helloworld-1.c:28: warning: implicit declaration of function `g_object_new' 
gtk-helloworld-1.c:28: error: `GTK_TYPE_WINDOW' undeclared (first use in this function) 
gtk-helloworld-1.c:34: error: `GTK_TYPE_LABEL' undeclared (first use in this function) 
gtk-helloworld-1.c:39: warning: implicit declaration of function `gtk_container_add' 
gtk-helloworld-1.c:39: warning: implicit declaration of function `GTK_CONTAINER' 
gtk-helloworld-1.c:39: warning: implicit declaration of function `GTK_WIDGET' 
gtk-helloworld-1.c:42: warning: implicit declaration of function `gtk_widget_show_all' 
gtk-helloworld-1.c:45: warning: implicit declaration of function `g_print' 
gtk-helloworld-1.c:46: warning: implicit declaration of function `gtk_main' 

我不知道什么,我在的包括条款做错了和库路径配置。如果有人能提供一些技巧来解决这个错误,那将会很棒。提前致谢。

回答

4

你需要反引号周围pkg配置:

gcc -Wall -g gtk-helloworld-1.c `pkg-config --cflags gtk+-2.0`... -o gtk ... 
+0

+1正确答案 – rasjani 2009-07-20 10:50:45