当前位置: 技术问答>linux和unix
关于gcc编译包含gtk+程序的问题!有图
来源: 互联网 发布时间:2015-03-29
本文导语: 我的c程序路径如下: /usr/mycpro/hello.c gtk.h的路径是: /usr/include/gtk-1.2/gtk/gtk.h 在hello.c中是这样包含的 #include 编译命令行如下: gcc hello.c -o hello 或者 gcc gtk-hello.c -o hello 'pkg-config --cflags --libs gtk+ -2.0' 得到的结果...
我的c程序路径如下:
/usr/mycpro/hello.c
gtk.h的路径是:
/usr/include/gtk-1.2/gtk/gtk.h
在hello.c中是这样包含的
#include
编译命令行如下:
gcc hello.c -o hello
或者
gcc gtk-hello.c -o hello 'pkg-config --cflags --libs gtk+ -2.0'
得到的结果是这样的:
gtk-hello.c:2:21: gtk/gtk.h: 没有那个文件或目录
gtk-hello.c:3: parse error before '*' token
gtk-hello.c:3: warning: data definition has no type or storage class
gtk-hello.c:5: parse error before '*' token
gtk-hello.c: In function `PrintAndExit':
gtk-hello.c:8: warning: assignment makes pointer from integer without a cast
gtk-hello.c:11: `window' undeclared (first use in this function)
gtk-hello.c:11: (Each undeclared identifier is reported only once
gtk-hello.c:11: for each function it appears in.)
gtk-hello.c: At top level:
gtk-hello.c:15: parse error before '*' token
gtk-hello.c: In function `main':
gtk-hello.c:24: `GtkWidget' undeclared (first use in this function)
gtk-hello.c:24: `window' undeclared (first use in this function)
gtk-hello.c:24: `label' undeclared (first use in this function)
gtk-hello.c:24: `vbox' undeclared (first use in this function)
gtk-hello.c:24: `hbox' undeclared (first use in this function)
gtk-hello.c:24: `button' undeclared (first use in this function)
gtk-hello.c:24: `separator' undeclared (first use in this function)
gtk-hello.c:27: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
gtk-hello.c:28: `FALSE' undeclared (first use in this function)
gtk-hello.c:29: `PrintByeAndExit' undeclared (first use in this function)
gtk-hello.c:37: warning: assignment makes pointer from integer without a cast
gtk-hello.c:42: `seprator' undeclared (first use in this function)
gtk-hello.c:47: `GTK_CAN_DEFAULT' undeclared (first use in this function)
我到现在还没有完成过一个有关gtk+的程序编译!所以不懂!请高手指点一二.
谢谢!
/usr/mycpro/hello.c
gtk.h的路径是:
/usr/include/gtk-1.2/gtk/gtk.h
在hello.c中是这样包含的
#include
编译命令行如下:
gcc hello.c -o hello
或者
gcc gtk-hello.c -o hello 'pkg-config --cflags --libs gtk+ -2.0'
得到的结果是这样的:
gtk-hello.c:2:21: gtk/gtk.h: 没有那个文件或目录
gtk-hello.c:3: parse error before '*' token
gtk-hello.c:3: warning: data definition has no type or storage class
gtk-hello.c:5: parse error before '*' token
gtk-hello.c: In function `PrintAndExit':
gtk-hello.c:8: warning: assignment makes pointer from integer without a cast
gtk-hello.c:11: `window' undeclared (first use in this function)
gtk-hello.c:11: (Each undeclared identifier is reported only once
gtk-hello.c:11: for each function it appears in.)
gtk-hello.c: At top level:
gtk-hello.c:15: parse error before '*' token
gtk-hello.c: In function `main':
gtk-hello.c:24: `GtkWidget' undeclared (first use in this function)
gtk-hello.c:24: `window' undeclared (first use in this function)
gtk-hello.c:24: `label' undeclared (first use in this function)
gtk-hello.c:24: `vbox' undeclared (first use in this function)
gtk-hello.c:24: `hbox' undeclared (first use in this function)
gtk-hello.c:24: `button' undeclared (first use in this function)
gtk-hello.c:24: `separator' undeclared (first use in this function)
gtk-hello.c:27: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
gtk-hello.c:28: `FALSE' undeclared (first use in this function)
gtk-hello.c:29: `PrintByeAndExit' undeclared (first use in this function)
gtk-hello.c:37: warning: assignment makes pointer from integer without a cast
gtk-hello.c:42: `seprator' undeclared (first use in this function)
gtk-hello.c:47: `GTK_CAN_DEFAULT' undeclared (first use in this function)
我到现在还没有完成过一个有关gtk+的程序编译!所以不懂!请高手指点一二.
谢谢!
|
'pkg-config --cflags --libs gtk+ -2.0'有两个问题
1、'应该是`,否则里边的内容不会执行
2、最后的-2.0什么意思?不要才对。
1、'应该是`,否则里边的内容不会执行
2、最后的-2.0什么意思?不要才对。
|
1、把-2.0去掉
2、把“'”都换成“`”。反单引号。
2、把“'”都换成“`”。反单引号。