【问题标题】:gcc error message with gtk 2.0gtk 2.0 的 gcc 错误消息
【发布时间】:2015-07-25 11:16:06
【问题描述】:

我的 main.c:

#include <stdlib.h>
#include <gtk/gtk.h>

int main(int argc, char **argv)
{
    return EXIT_SUCCESS;
}  

我使用:

gcc `pkg-config --cflags --libs libgtk+-2.0` -o tresor main.c  

但我收到此错误:

Package libgtk+-2.0 was not found in the pkg-config search path.  
Perhaps you should add the directory containing `libgtk+-2.0.pc'  
to the PKG_CONFIG_PATH environment variable  
No package 'libgtk+-2.0' found  
main.c:2:21: fatal error: gtk/gtk.h: No such file or directory  
 #include <gtk/gtk.h>
                     ^  
compilation terminated.  
make: *** [tresor] Error 1  

我检查了 libgtk2.0-dev 和 libgtk2.0-0 并且它已经安装了。 我尝试更新,升级删除并再次安装。它不起作用。

【问题讨论】:

  • 尝试改成pkg-config --cflags --libs gtk+-2.0
  • 是的,愚蠢的错误。你能把它写成答案,这样我就可以结束这个话题了吗?

标签: c gcc path gtk pkg-config


【解决方案1】:

只需要将包名调整为gtk+-2.0即可:

gcc `pkg-config --cflags --libs gtk+-2.0` -o tresor main.c

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-29
    • 2021-11-03
    • 2020-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多