免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5985 | 回复: 4
打印 上一主题 下一主题

gtk 編譯問題 [复制链接]

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:49:03
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-16 15:30 |只看该作者 |倒序浏览
  1. gtk_include=-IC:/MinGW/include/gtk-2.0 \
  2. -IC:/MinGW/lib/gtk-2.0/include -IC:/MinGW/include/atk-1.0 \
  3. -IC:/MinGW/include/pango-1.0 -IC:/MinGW/include/glib-2.0 \
  4. -IC:/MinGW/lib/glib-2.0/include

  5. gtk_lib=-LC:/MinGW/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 \
  6. -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 \
  7. -lgmodule-2.0 -lglib-2.0

  8. target_dir=Debug

  9. main: Hello.c
  10.         gcc -mwindows -mms-bitfields -s -Wall Hello.c -o HelloGTK \
  11.         ${gtk_include} ${gtk_lib}
  12.         mkdir ${target_dir}
  13.         mv *.exe ${target_dir}/
  14. all:
  15.         ${MAKE} main
  16. .PHONY : clean
  17. clean :
  18.         -rm ${target_dir}/*
  19.         rmdir ${target_dir}


复制代码


我是用 eclipse + mingw + 一些gtk 相關函式庫 , 上面是我的makefile
用eclipse 可以正常編譯成功結果也正確 , 不過我想改用 command line 去編譯就失敗

我下的指令是
gcc -mwindows -mms-bitfields -s -Wall Hello.c -o HelloGTK `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

出現錯誤訊息是
gcc: Hello.c: No such file or directory
gcc: `pkg-config: No such file or directory
gcc: gtk+-2.0`: No such file or directory
gcc: `pkg-config: No such file or directory
gcc: gtk+-2.0`: No such file or directory
gcc: no input files


不知道是否是我指令參數下錯?  環境是 windows


還有一個問題就是我又安裝Glade 結果 eclipse 變成不能使用@@ , 我想應該是環境參數被Glade 給更改...

我用pkg-config --cflags gtk+-2.0 找路徑及參數出現下面錯誤訊息
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


正常訊息應該是一些路徑參數 ,下面是正常情況
-IC:/MinGW/include/gtk-2.0
-IC:/MinGW/lib/gtk-2.0/include -IC:/MinGW/include/atk-1.0
-IC:/MinGW/include/pango-1.0 -



謝謝

论坛徽章:
0
2 [报告]
发表于 2007-03-16 17:12 |只看该作者
貌似mingw并没有提供shell环境,那么这句

`pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

不会被扩展成正确的内容。

建议你安装cygwin。

论坛徽章:
0
3 [报告]
发表于 2007-03-17 20:37 |只看该作者
你编译的时候使用的是什么命令行窗口?不会是 Windows 提供的那个吧?应该在 msys 终端窗口下进行编译。MinGW 安装之后,安装 MSYS 了吗?

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:49:03
4 [报告]
发表于 2007-03-18 15:58 |只看该作者
MSYS ?? 这是什么? @@

我是安装了 Gtk+/Win32 Development Environment  + Gtk+/Win32 Runtime Environment + mingw

我是使用 windows xp 的 cmd  ...命令行窗口

谢谢

论坛徽章:
0
5 [报告]
发表于 2007-03-18 21:51 |只看该作者
Windows 的命令行窗口功能较弱,Unix/Linux 下的 shell 提供的许多功能它都不具备或支持,所以通常需要另外安装一个类似 Unix/Linux 的 shell 的支撑环境。对于 MinGW 来说,通常使用的就是 MSYS。可在 MinGW 的主页上下载和安装;http://www.mingw.org/

安装之后,从开始菜单中可找到新安装的 msys 执行,就会打来一个 MINGW32 终端窗口,在此窗口中执行你上面的命令应该就可以了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP