You are not logged in.

#1 2006-03-16 20:29:22

DarkTux
Member
From: Prague, Czech Republic
Registered: 2006-01-23
Posts: 17
Website

libglade linking problem - solved

Hi everybody, I have a little bit trouble with linking libglade, I really dont know and dont have any idea where is problem, for testing, I have written simple hello world programm, in glade i have created hello world dialogue, i have copied xml file and create main.c :

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

        GladeXML *xml;

int main (int argc, char **argv) {
        

        GtkWidget *app1;
    
        gtk_init (&argc, &argv);
        xml = glade_xml_new ("hello.glade", NULL, NULL);
        glade_xml_signal_autoconnect (xml);
    
        glade_xml_get_widget(xml, "app1");
        gtk_widget_show(app1);

        gtk_main ();
        return 0;
}

Then I made easy makefile

CC=gcc
CFLAGS=-g -W -Wall `pkg-config --cflags`
LIBS=`pkg-config --libs`

TARGET=hello
OBJECTS=main.o

$(TARGET): $(OBJECTS)
    $(CC) -o $@ $^ $(LIBS)

clean:
    rm -f *.o *~ $(TARGET) *.bak

So I have run it, and ...

main.c:6:25: error: glade/glade.h: no such file or directory
main.c:8: error: syntax error before '*' token
main.c:8: warning: type defaults to 'int' in declaration of 'xml'
main.c:8: warning: data definition has no type or storage class
main.c: In function 'main':
main.c:16: warning: implicit declaration of function 'glade_xml_new'
main.c:16: warning: assignment makes pointer from integer without a cast
main.c:17: warning: implicit declaration of function 'glade_xml_signal_autoconne ct'
main.c:19: warning: implicit declaration of function 'glade_xml_get_widget'

I know this is a typical bad linking error, but I have linked it with libglade as you can see in a makefile. When I try use libglade-config instead of pkg-config I got some errors.

Do you have any suggestions?


Nothing is perfect, just Linux and me :-D

Offline

#2 2006-03-17 04:23:48

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: libglade linking problem - solved

Try adding:
-I/usr/include
to your compile line.

Offline

#3 2006-03-17 07:58:25

DarkTux
Member
From: Prague, Czech Republic
Registered: 2006-01-23
Posts: 17
Website

Re: libglade linking problem - solved

Thank for post, but I have tried before and now again, the absolutely same error :-(


Nothing is perfect, just Linux and me :-D

Offline

#4 2006-03-17 08:08:42

Largon
Member
From: Czech Republic
Registered: 2004-11-03
Posts: 18
Website

Re: libglade linking problem - solved

`pkg-config --cflags libglade-2.0` and `pkg-config --libs libglade-2.0`

Offline

Board footer

Powered by FluxBB