Re: NOTE: Compiling my 1st GTK+ program



On Thu, 2004-08-26 at 15:18, Maya wrote:
I did as you suggested, but no, it did not work.
I tried to compile the program using the comand prompt,
but I get the same results.

I'll ignore that the results weren't *exactly* the same.

Mam, I never thought that compiling a GTK+ program was going
to be so difficult; it was much easier with FLTK.

If you're looking for simple, try:

        CC=gcc -Wall -g -ansi
        CFLAGS=`pkg-config --cflags gtk+-2.0`
        LDFLAGS=`pkg-config --libs gtk+-2.0`
        EXES=base
        
        all: $(EXES)
        
        clean:
                rm -f $(EXES)
        
For a single source file with no object dependencies, this should work
every time. (This Makefile won't capitalize the executable name like
yours, in case that was important to you.) But, for the record, I
copy/pasted your Makefile and had no trouble or warnings compiling with
it, except for the "--libs" bit.


Well, I'll keep trying, eventually I'll find out if it me [smack me on the forehead] or the cygwin package 
that is the problem [file the bug report].

For the time being, here is the last encarnation of the "Makefile"
# Exception Makefile
# Compiler name
CC=gcc
# Flagas
CFLAGS = -Wall -g -ansi `pkg-config --cflags gtk+-2.0`
LDFLAGS = `pkg-config --libs gtk+-2.0`
# Variables
OBJS = base.o  
EXEC = Base
#Application name
all: $(OBJS)
    $(CC) $(LDFLAGS) $(OBJS) -o $(EXEC)

$(EXEC): $(OBJS)

base.o: 
    $(CC) $(CFLAGS) -c base.c

clean:
    rm -f $(OBJS)
    rm -f $(EXEC)

PHONY: clean

---------- eof ---------------

And this is the error I am gettting:

base.o(.text+0x44): In function `main':
/home/Jamil/dev/jme/tmp/GTK_TST/base.c:7: undefined reference to `_gtk_init_abi_check'
base.o(.text+0x50):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:9: undefined reference to `_gtk_window_new'
base.o(.text+0x5e):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:10: undefined reference to `_gtk_widget_show'
base.o(.text+0x63):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:12: undefined reference to `_gtk_main'
collect2: ld returned 1 exit status
make: *** [all] Error 1



"Alan M. Evans" <ame1 extratech com> wrote:

Take the "--libs" bit out of your CFLAGS.

On Thu, 2004-08-26 at 14:56, Maya wrote:
Oops, I forgot to paste the errors I am getting now; after doing the modifications:
Sorry...:(
gcc: --export-dynamic: linker input file unused because linking not done
gcc: -lgtk-x11-2.0: linker input file unused because linking not done
gcc: -lgdk-x11-2.0: linker input file unused because linking not done
gcc: -latk-1.0: linker input file unused because linking not done
gcc: -lgdk_pixbuf-2.0: linker input file unused because linking not done
gcc: -lm: linker input file unused because linking not done
gcc: -lpangoxft-1.0: linker input file unused because linking not done
gcc: -lpangox-1.0: linker input file unused because linking not done
gcc: -lpango-1.0: linker input file unused because linking not done
gcc: -lgobject-2.0: linker input file unused because linking not done
gcc: -lgmodule-2.0: linker input file unused because linking not done
gcc: -lglib-2.0: linker input file unused because linking not done
gcc: -lintl: linker input file unused because linking not done
gcc: -liconv: linker input file unused because linking not done
base.o(.text+0x44): In function `main':
/home/Jamil/dev/jme/tmp/GTK_TST/base.c:7: undefined reference to `_gtk_init_abi_check'
base.o(.text+0x50):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:9: undefined reference to `_gtk_window_new'
base.o(.text+0x5e):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:10: undefined reference to `_gtk_widget_show'
base.o(.text+0x63):/home/Jamil/dev/jme/tmp/GTK_TST/base.c:12: undefined reference to `_gtk_main'
collect2: ld returned 1 exit status
make: *** [all] Error 1
-- 
Alan M. Evans <ame1 extratech com>




Thanks in advance
-- 
Alan M. Evans <ame1 extratech com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]