2016-12-02 3 views
-1

私はCで新しく、GUIの作成方法を学び始めました。GTK Cライブラリの使い方は?

gcc `pkg-config gtk+-2.0 --cflags` example.c -o example `pkg-config gtk+-2.0 --libs` 
:唯一の方法はプログラムの実行が

gcc simple.c -o simple -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 

私はちょうどgcc simple.cを実行した場合、私はlibが含まれるように、他の「伝統的」な方法を行う場合、それは私に

In file included from /usr/include/glib-2.0/glib/galloca.h:32:0, 
      from /usr/include/glib-2.0/glib.h:30, 
      from /usr/include/glib-2.0/gobject/gbinding.h:28, 
      from /usr/include/glib-2.0/glib-object.h:23, 
      from /usr/include/glib-2.0/gio/gioenums.h:28, 
      from /usr/include/glib-2.0/gio/giotypes.h:28, 
      from /usr/include/glib-2.0/gio/gio.h:26, 
      from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, 
      from /usr/include/gtk-2.0/gdk/gdk.h:32, 
      from /usr/include/gtk-2.0/gtk/gtk.h:32, 
      from graphical.c:1:/usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or catalog compilation terminated. 

を与えているいくつかの理由

それは私に与えます:

Package gtk+-2.0 was not found in the pkg-config search path. 
Perhaps you should add the directory containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH environment variable 
No package 'gtk+-2.0' found 
graphical.c:1:21: fatal error: gtk/gtk.h: No such file or catalog 

GTKを組み込む正しい方法は何ですか?

+1

[CとGtk +をLinux上でGCCでコンパイルするにはどうすればいいですか?](http://stackoverflow.com/questions/14944866/how-to-compile-c-and-gtk-with-gcc- on-linux) – Scribblemacher

+0

@Scribblemacherこの方法のどれも動作しません。 –

+0

@ГригорийШепелевそれはおそらくローカライズされているでしょう。 –

答えて

0

私は問題が何かを考え出しました。 私はlinuxbrewをインストールしていました。何らかの理由で、pkg-configはエクスポートを強制してもreposのパスを取っていました。 linuxbrewを完全に削除しました。 :)

関連する問題