2009-07-13 72 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