gtk-2.0 的 pkgconfig 选项
GCC 返回以下错误
/usr/include/gtk-2.0/gtk/gtk.h:32:21: fatal error: gdk/gdk.h: No such file or directory
使用 find /usr -name 'gdk.h'
我能够找到丢失的标头,
/usr/include/gtk-2.0/gdk/gdk.h
我猜测该错误是由于编译器不存在而引起的在 gtk-2.0
中查找 gdk
目录,尽管我可能会弄错。如果我是正确的,gtk-2.0
的 pkgconfig
选项是什么,如果我错了,我到底做错了什么?
GCC is returning the following error
/usr/include/gtk-2.0/gtk/gtk.h:32:21: fatal error: gdk/gdk.h: No such file or directory
Using find /usr -name 'gdk.h'
I was able to locate the missing header in
/usr/include/gtk-2.0/gdk/gdk.h
I'm guessing the error is arising form the fact that the compiler isn't looking in gtk-2.0
for the gdk
directory, though I could be mistaken about that. If I am correct, what is the pkgconfig
option for gtk-2.0
, and if I'm wrong, what is it I'm really doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
第一个提供链接库的选项,第二个提供路径; 我通常会使用类似“当然”的东西
当我想“即时”编译时, 。否则,您应该使用半自动方式来执行此操作(配置脚本、Makefile 等)
the first gives the option to link the libs, the second the paths; I usually use something like
of course when I want to compile "on the fly". Otherwise, you should use a semiautomatic way of doing this (configure script, Makefiles and so on)
对我来说(在 Debian 上)这是一个不同的问题:
然后我想起了前一周我在将 libpng 升级到最新实验版本后遇到的 X11-startup-fail 问题 - 我通过手动恢复以前版本的 .so 文件修复了该问题..不过我忘记了 pkgconfig 文件。因此,这个构建问题可以通过正确地“将 libpng12-0:i386 从 1.5.11-1 降级到 1.2.49-1”来解决。
底线:查看实际错误上方的配置输出。并且不要安装实验性的 libpng,它很可能会完全破坏您的 GUI ;)
For me (on Debian) it was a different problem:
Then I remembered this X11-startup-fail problem I was having the week before, right after upgrading libpng to latest experimental - which I had fixed by manually restoring previous version's .so files.. I forgot the pkgconfig files though. So this build problem fixed by properly "downgrading libpng12-0:i386 from 1.5.11-1 to 1.2.49-1."
Bottom line: look at the configure output above the actual error. And don't install experimental libpng, chances are high it'll brick your GUI completly ;)
技巧
$(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs)
解决了我的问题。我想知道为什么 gtk/gtk.h 不在 gtk 目录中。某种重定向混乱。
The trick
$(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs)
solved my problem.I wonder why gtk/gtk.h had is not in the gtk dir. kind of redirection confusions.