All,
I am running Ubunut 16.04 and have versions of GTK 2 and 3 installed:
ii libgtk-3-0:amd64 3.18.9-1ubuntu3.3 amd64 GTK+ graphical user interface library
ii libgtk2.0-0:amd64 2.24.30-1ubuntu1.16. amd64 GTK+ graphical user interface library
UPDATE:
I saw the debugging was quiet and changed it to verbose, and now I see that I am accessing both GTK 2 and 3!
How do I configure this so that I am using only one version for both GTK and wxWidgets?
I've also updated the logging below.
I installed wx as suggested here: http://codelite.org/LiteEditor/WxWidgets31Binaries#toc2
First getting the public key and then creating the local repository:
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
sudo apt-add-repository 'deb http://repos.codelite.org/wx3.1.0/ubuntu/ xenial universe'
I then edited /etc/apt/sources.list to remove the comment indicator, #, at the start of the line.
sudo apt-get update
sudo apt-get install libwxbase3.1-0-unofficial
In CodeBlocks, I created a default wxWidgets application selecting wxSmith and compiled.
Compilation is successful with no errors or warnings, but the executable immediately fails.
Running with the debugger, I see that a GTK file is not able to be found.
The project was named 'Graphs' and the entire debug output is below:
[debug]Starting program: /home/yamex5/mike/langs/cpp/SoloLearn/templates/Graphs/bin/Debug/Graphs
[debug][Thread debugging using libthread_db enabled]
[debug]Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[debug](Graphs:28558): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
[debug]Program received signal SIGTRAP, Trace/breakpoint trap.
[debug]0x00007ffff45bba5b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]>>>>>>cb_gdb:
Program received signal SIGTRAP, Trace/breakpoint trap.
In g_logv () (/lib/x86_64-linux-gnu/libglib-2.0.so.0)
[debug]> bt 30
[debug]#0 0x00007ffff45bba5b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#1 0x00007ffff45bbbcf in g_log () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#2 0x00007ffff68d0b7a in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#3 0x00007ffff45bfbe7 in g_option_context_parse () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#4 0x00007ffff68d0fe8 in gtk_parse_args () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#5 0x00007ffff68d1049 in gtk_init_check () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#6 0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364
[debug]#7 0x00007ffff70ee8ba in wxEntryStart (argc=@0x7ffff748bd30: 1, argv=argv@entry=0x657510) at ../src/common/init.cpp:333
[debug]#8 0x00007ffff70eebba in wxInitialize (argc=@0x7ffff748bd30: 1, argv=0x657510) at ../src/common/init.cpp:540
[debug]#9 0x00007ffff70eec0b in wxInitializer::wxInitializer (argv=<optimized out>, argc=<optimized out>, this=<synthetic pointer>) at ../include/wx/init.h:92
[debug]#10 wxEntry (argc=<optimized out>, argv=<optimized out>) at ../src/common/init.cpp:473
[debug]#11 0x000000000040a168 in main (argc=1, argv=0x7fffffffe278) at /home/yamex5/mike/langs/cpp/SoloLearn/templates/Graphs/GraphsApp.cpp:17
[debug]>>>>>>cb_gdb:
[debug]> frame 6
[debug]364 ../src/gtk/app.cpp: No such file or directory.
[debug]#6 0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364
[debug]>>>>>>cb_gdb:
364 ../src/gtk/app.cpp: No such file or directory.
#6 0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364
How does one configure the version of GTK to be used for wxWidgets please?
The source code is not needed for correct operation. But installing it might help with debugging what is going on.
My guess is that you have assertions enabled and you're hitting on. Start the program in terminal and you'll probably see which one it is.
Thanks for the quick reply!
After enabling more debugging, I see that GTK is trying to use both versions 2 and 3!
[debug](Graphs:28558): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Is there a way to specify which version to use?
I'm leery of uninstalling GTK+2.0 since that was on my system initially and I don't want to chance breaking something else.
UPDATE:
I just looked through my CodeBlocks linker settings and see that I've added:
`pkg-config --libs gtk+-3.0`
Should that be there, should I remove it and let CodeBlocks resolve which version of GTK+ to use, or just remove GTK+2.0?
-Mike