Author Topic: [SOLVED] path to glade problem  (Read 11680 times)

Offline Fastcat

  • Single posting newcomer
  • *
  • Posts: 3
[SOLVED] path to glade problem
« on: May 27, 2008, 12:33:42 pm »
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;
}



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 ===|

« Last Edit: May 27, 2008, 02:17:35 pm by Fastcat »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: path to glade problem
« Reply #1 on: May 27, 2008, 12:51:09 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.

Offline Fastcat

  • Single posting newcomer
  • *
  • Posts: 3
Re: path to glade problem
« Reply #2 on: May 27, 2008, 01:50:33 pm »
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 ===|
« Last Edit: May 27, 2008, 01:54:06 pm by Fastcat »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: path to glade problem
« Reply #3 on: May 27, 2008, 02:06:20 pm »
Did you really make this step ?
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".

Offline Fastcat

  • Single posting newcomer
  • *
  • Posts: 3
Re: path to glade problem
« Reply #4 on: May 27, 2008, 02:17:16 pm »
Did you really make this step ?
Add "glade-2.0" to "Linker Settings -> Link Libraries".

my fault... it works ;-)

Offline deciimal

  • Single posting newcomer
  • *
  • Posts: 2
Re: [SOLVED] path to glade problem
« Reply #5 on: December 13, 2010, 07:30:00 pm »
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


Offline deciimal

  • Single posting newcomer
  • *
  • Posts: 2
Re: [SOLVED] path to glade problem
« Reply #6 on: December 13, 2010, 07:55:44 pm »
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...


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: [SOLVED] path to glade problem
« Reply #7 on: December 13, 2010, 10:10:00 pm »
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]