Gtk-ERROR **:检测到GTK + 2.x符号 [英] Gtk-ERROR **: GTK+ 2.x symbols detected

查看:3323
本文介绍了Gtk-ERROR **:检测到GTK + 2.x符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  gcc evis.c`pkg-config  - 使用gcc编译我的c程序, -cflags --libs gtk + -2.0 --libs clutter-gtk-1.0 --libs gthread-2.0` -Wall -o evis 

现在我的代码会编译一些警告,但仍然会结束。当我尝试运行我的程序时,我得到:

 (evis:1820):Gtk-ERROR **:GTK + 2.x检测到符号。在同一过程中不支持使用GTK + 2.x和GTK + 3 

如何解决此错误?我怎么知道去哪里看?有哪种工具可以在线使用,可以在我的代码中扫描GTK3符号?我正在编译GTK + 2,所以我不明白这是怎么回事。 你正在链接相同的程序到Gtk + 2.0和Gtk + 3.0。这是行不通的。



很容易检查:只需运行 pkg-config 命令standalone即可。顺便说一句,你不需要重复 - libs 这么多次,并且因为我们正在寻找链接错误,所以我忽略了 - 为了清晰起见,cflags

  $ pkg-config --libs gtk + -2.0 clutter-gtk-1.0 gthread-2.0 

现在,它编写了很多库名,但如果仔细观察,找到这些:

  ... -lgtk-x11-2.0 ... -lgtk-3 ... 

但他们从哪里来?那么,Gtk + -2部分很简单:您正在命令行中寻求它! Gtk + -3部分只有一个候选人:

  $ pkg-config --libs clutter-gtk-1.0 
... -lgtk-3 ...

宾果!所以Clutter-gtk是一个Gtk + -3库。所以应该是你的程序是你想要使用Clutter-gtk。

你的问题的解决方案是:




  • 将程序移植到Gtk + -3并相应地更改编译器命令。使用不同版本的使用Gtk + -2的Clutter-gtk。我认为如果你自己编译Clutter-gtk,你可以选择依赖。
  • 不要使用Clutter-gtk。

    I'm compiling my c application with gcc with the following flags:

    gcc evis.c `pkg-config --cflags --libs gtk+-2.0 --libs clutter-gtk-1.0 --libs gthread-2.0` -Wall -o evis
    

    Now my code compiles with a few warnings but still finishes. When I try to run my program I get:

    (evis:1820): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
    

    How do I troubleshoot this error? How do I know where to look? Is there some kind of tool I could use online that would scan for GTK3 symbols in my code? I'm compiling with GTK+2 so I don't understand how this is happening.

    解决方案

    You are linking the same program to Gtk+2.0 and Gtk+3.0. And that will not work.

    It is easy to check: just run the pkg-config command standalone. BTW, you do not need to repeat --libs so many times, and since we are looking for linking errors, I'm ommiting the --cflags for clarity:

    $ pkg-config --libs gtk+-2.0 clutter-gtk-1.0 gthread-2.0
    

    Now, it writes a lot of library names, but if you look carefully you'll find these ones:

    ... -lgtk-x11-2.0 ... -lgtk-3 ...
    

    But where do they come from? Well, the Gtk+-2 part is easy: you are asking for it in the command line! The Gtk+-3 part has only one candidate:

    $ pkg-config --libs clutter-gtk-1.0
    ... -lgtk-3 ...
    

    Bingo! So Clutter-gtk is a Gtk+-3 library. And so should be your program is you want to use Clutter-gtk.

    The solutions to your problem are:

    • Port your program to Gtk+-3 and change your compiler command accordingly.
    • Use a different version of Clutter-gtk that uses Gtk+-2. I think you can choose the dependency if you compile Clutter-gtk yourself.
    • Do not use Clutter-gtk.

    这篇关于Gtk-ERROR **:检测到GTK + 2.x符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆