User forums > Using Code::Blocks
Linux with wxwidgets gtk undefined reference
mimosa:
Hello!
wxWidgets version: 3.0.1 (when in a terminal and typing wx-config --version)
Codeblocks version: 13.12 64bit build Jan 27 2014 with wx2.8.12 (linux unicode) installed with ubuntu software center
Compiler: gnu gcc 4.8.2
platform/OS: Linux 64 bit Ubuntu 14.04.1 LTS (codename trusty)
I posted my question on wxwidgets forum (http://forums.wxwidgets.org/viewtopic.php?f=19&t=40042), but no solution were found and it was recommended I ask here.
here is how I configured & installed my own wxwidgets in a terminal, under a folder I created within te unzipped folder (I do have the libwxgtk3.0-dev package installed):
../configure --with-gtk=3 --enable-debug --enable-debug_info --enable-debug_gdb --with-opengl --enable-monolithic
(then followed by "make" and "make install")
I then go into the samples folder, and compile the calendar sample and it works fine. my wxwidgets 3.0.1 dynamic library seems to be OK.
I create a new project in codeblocks like this:
File->New->Projects
GUI type
wxWidgets project
I select "wxWidgets 3.0.x" in the wxWidgets version option
wxSmith for my preferred GUI builder
Frame based application type
GNU GCC compiler
Advanced options: Dynamic: YES, and I select Unicode YES
Create and use precompiled header: CHECKED
The wizard adds these automatically:
`wx-config --cflags`
`wx-config --libs`
I also tried to replace with this (same I think):
`wx-config --cxxflags`
`wx-config --libs`
there is a global variable "wx" defined within Code::Blocks and the "base" points to this:
/usr/include/wx-3.0
I get this message when I try to compile:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.a(gtkshow.o)||undefined reference to symbol 'gdk_app_launch_context_set_screen'|
So it seems I can't compile a project with wxwidgets 3.0.1 in Code::Blocks. The wxwidgets forum suspect something is not done correctly in Code::Blocks, and thus I am stuck.
here is the output for `wx-config --cxxflags` from a console
-I/usr/local/lib/wx/include/gtk3-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
and the output for `wx-config --libs`
-L/usr/local/lib -pthread -lwx_gtk3u-3.0
what am I missing? Thank you!
SteelRat:
You have to add additional libs to wx-config command, something like this:
`wx-config --libs std aui propgrid`
mimosa:
--- Quote from: SteelRat on September 11, 2014, 09:57:02 am ---You have to add additional libs to wx-config command, something like this:
`wx-config --libs std aui propgrid`
--- End quote ---
I just did that and try to rebuild. Same error.
stahta01:
--- Quote from: mimosa on September 11, 2014, 05:01:51 pm ---
--- Quote from: SteelRat on September 11, 2014, 09:57:02 am ---You have to add additional libs to wx-config command, something like this:
`wx-config --libs std aui propgrid`
--- End quote ---
I just did that and try to rebuild. Same error.
--- End quote ---
Did you exit out of CB and reenter it after making the changes?
If not, try doing so.
The CB Devs disagree whether exiting and restarting CB is needed for changes in back-ticks expressions.
Tim S.
SteelRat:
I just noticed that undefined reference is not to wxWidgets.
Try it `pkg-config --libs gtk+-2.0`
Navigation
[0] Message Index
[#] Next page
Go to full version