User forums > Using Code::Blocks
[SOLVED] path to glade problem
Fastcat:
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:
--- Code: ---#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;
}
--- End code ---
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 ===|
Jenna:
--- 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
--- End quote ---
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.
Fastcat:
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 ===|
Jenna:
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".
--- End quote ---
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".
Fastcat:
--- 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".
--- End quote ---
--- End quote ---
my fault... it works ;-)
Navigation
[0] Message Index
[#] Next page
Go to full version