2

このマニュアルの 31 ページから始まるセクション 3.4.2 に従おうとしています。ただし、ターゲットを DIABLO_X86 ではなく DIABLO_ARMEL に設定したため、このコマンドでは異なる結果が得られました。

[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 と libs の結果、および例で説明されている内容とコマンド ウィンドウに表示されている内容の間の結果を確認しました。

とにかく、端末にエラーメッセージが表示されることは期待されていませんが、次のようになりました。

[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

1 に答える 1

4

pkg-config の前後に逆引用符が必要です。

gcc -Wall -g gtk-helloworld-1.c `pkg-config --cflags gtk+-2.0`... -o gtk ...
于 2009-07-15T20:10:37.487 に答える