I have Debian system and I installed C::B and wxWidget from here http://apt.jenslody.de/ and libglade from repo
I've created new gtk+ project and change default source code to this:
#include <stdlib.h>
#include <stdio.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GladeXML *xml;
gtk_init(&argc, &argv);
glade_init();
xml = glade_xml_new("test.glade", "window1", NULL);
if (!xml) {
g_warning("Failed to create the interface");
return 1;
}
gtk_main();
return 0;
}
I read the faq (http://wiki.codeblocks.org/index.php?title=FAQ&Itemid=5#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
)
and set path:
Settings -> Search directories -> Compiler : /usr/include/libglade-2.0/glade
Settings -> Search directories -> Linker : /usr/lib/libglade/2.0
but things doesn't work ;-(
/home/fastcat/projects/tglade/main.c|3|error: glade/glade.h: No file or directory|
/home/fastcat/projects/tglade/main.c||In function ‘main’:|
/home/fastcat/projects/tglade/main.c|8|error: ‘GladeXML’ undeclared (first use in this function)|
/home/fastcat/projects/tglade/main.c|8|error: (Each undeclared identifier is reported only once|
/home/fastcat/projects/tglade/main.c|8|error: for each function it appears in.)|
/home/fastcat/projects/tglade/main.c|8|error: ‘xml’ undeclared (first use in this function)|
/home/fastcat/projects/tglade/main.c|10|warning: implicit declaration of function ‘glade_init’|
/home/fastcat/projects/tglade/main.c|11|warning: implicit declaration of function ‘glade_xml_new’|
||=== Build finished: 5 errors, 2 warnings ===|
Quote from: Fastcat on May 27, 2008, 12:33:42 PM
Settings -> Search directories -> Compiler : /usr/include/libglade-2.0/glade
Settings -> Search directories -> Linker : /usr/lib/libglade/2.0
Remove "/glade" from compiler's search directory.
Add "glade-2.0" to "Linker Settings -> Link Libraries".
And if you don't need any of the libs in "/usr/lib/libglade/2.0" later in the project you can remove it from linker's search directories.
Thank you. Now C::B found libs and headers but there are some errors
obj/Debug/main.o||In function `main':|
/home/fastcat/projects/tglade/main.c|10|undefined reference to `glade_init'|
/home/fastcat/projects/tglade/main.c|11|undefined reference to `glade_xml_new'|
||=== Build finished: 2 errors, 0 warnings ===|
Did you really make this step ?
Quote from: jens on May 27, 2008, 12:51:09 PM
Add "glade-2.0" to "Linker Settings -> Link Libraries".
There should be a shared library called "/usr/lib/libglade-2.0.so" (on sid it's a symlink to "/usr/lib/libglade-2.0.so.0.0.7", depends on the version og the library on your system)
and a static one called "/usr/lib/libglade-2.0.a".
"/usr/lib" is standard search-path for libraries, so it could be found and the "undefined reference" should go away.
If the libraries are there and you really added the lib to link-libraries and it still does ot work can you please post full commandline of Build Log:
Make sure "Settings -> Compiler and Debugger... -> Global Compiler settings -> [the compiler you use] -> Other settings" (the rightmost tab) -> Compiler logging" is set to "Full command line".
Quote from: jens on May 27, 2008, 02:06:20 PM
Did you really make this step ?
Quote from: jens on May 27, 2008, 12:51:09 PM
Add "glade-2.0" to "Linker Settings -> Link Libraries".
my fault... it works ;-)
Further to This.. I know this Topic is real old.. But IT IS RELEVANT.
I am Using C::B 10.5
and glade Glade 3.7.1
I could Not get the instructions on how to add the link library.. Rather Understand it.. I tried the link LIbrary option I could find the path for glade 2/3
For the following Instructions..
Add "glade-2.0" to "Linker Settings -> Link Libraries".
If someone could help me on this.
Enviroment Fedora 14.
Code::Blocks 10.5
Glade 3.7.1
Thanks... and rgds
UH OH. got it..
The library is in /usr/lib.. and there was a error message from the linker giving the exact location..
Done.. .. and thanks Guys...
I think that the preferred way to setup this is through pkg-config.
Putting something like `pkg-config --libs libglade-2.0` in the linker -> other options and `pkg-config --cflags libglade-2.0` in compiler other options is way safer setup.