Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: baggio on May 27, 2011, 08:49:45 pm
-
Hi everyone,
I'm a beginner in Gtk. really need some help here.
I create a Gtk+ project in codeBlocks, and I encountered this problem:
Linking console executable: bin\Debug\test.exe
obj\Debug\main.o: In function `main':
C:/CodeBlocks/project/test/main.c:9: undefined reference to `glade_xml_new'
C:/CodeBlocks/project/test/main.c:10: undefined reference to `glade_xml_signal_autoconnect'
C:/CodeBlocks/project/test/main.c:11: undefined reference to `glade_xml_get_widget'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
3 errors, 0 warnings
.
And my 'Linker seeting'-->'Other linker option's: `pkg-config --cflags --libs gtk+-2.0 libglade-2.0`
I've been trying to solve this problem for a long time. I am very anxious to find the answer.who can help me?
Thank you!
-
Turn on Full Compiler Logging
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Tim S.
-
Thanks.
I did as you said.But unfortunately, the problem still exists.
my setting is:
complier setting-->other options-->
-mms-bitfields -IC:/Gtk+/include -IC:/Gtk+/include/gtk-2.0 -IC:/Gtk+/lib/gtk-2.0/include
-IC:/Gtk+/include/atk-1.0 -IC:/Gtk+/include/cairo -IC:/Gtk+/include/pango-1.0
-IC:/Gtk+/include/glib-2.0 -IC:/Gtk+/lib/glib-2.0/include -IC:/Gtk+/include/libpng12
-IC:/Gtk+/include/gail-1.0 -IC:/Gtk+/include/gtkglext-1.0 -IC:/Gtk+/include/libglade-2.0
-IC:/Gtk+/include/libgladeui-1.0 -IC:/Gtk+/include/libxml -IC:/Gtk+/lib/gtkglext-1.0/include
-IC:/Gtk+/include/gtkglext-1.0/gdk -IC:/Gtk+/include/glib-2.0 -IC:/Gtk+/bin
-IC:/Gtk+/gtkglext-examples
linker settings-->other linker options:
`pkg-config --cflags --libs gtk+-2.0 libglade-2.0`
but it still can't compliing successfully. so why? where is the problem?
-
but it still can't compliing successfully. so why? where is the problem?
Most likely misconfguration and misunderstading of configuration options.
For pkg-config and similar:
use the --cflags (or --cppflags ?) parameter in compiler options and the --libs parameter in the linker settings.
If you really have to specify additional include paths (the most should come from pkg-config --c{pp}flags ) add them to the appropriate search directories in the respective tab.
Full commandline logging shows the full commandline in the build log, so you can see what is sent to the compiler, to be able to fix your problem.
It does not change the commands send to the compiler.
-
Thank you!Administrator.
I will try that.
-
Thanks!!!!
I really appreciate your help!!
After browsing the same problem you had settled in three years ago in http://forums.codeblocks.org/index.php?topic=8488.0
I just do as you said Add "glade-2.0" to "Linker Settings -> Link Libraries".
Then it works!
thanks!!