Re: [gtkmm] Compiling my first gtkmm program - HELP!!



Maya wrote:
Hi folks!!
I have been trying to compile an example program included in the gtkmm documentation, but for some reason I am having a lot of errors and/or warnings displayed.
The Makefile I wrote is this:
------
CPP=g++
LDLIBS=`pkg-config gtkmm-2.0 --libs`
CFLAGS= -Wall -g `pkg-config gtkmm-2.0 --cflags --libs`
OBJS = main.o wimm.o
EXEC = wimm.exe

$(EXEC): $(OBJS)
[TAB]    $(CPP) $(OBJS) $(LDLIBS) -o $(EXEC)

main.o: main.cpp wimm.hpp
[TAB]    $(CPP) $(CFLAGS) -c main.cpp

wimm.o: wimm.hpp
[TAB]    $(CPP) $(CFLAGS) -c wimm.cpp
  clean:
   rm -f $(OBJS)
   rm -f $(EXEC)

PHONY: clean

Change your CFLAGS to:

CFLAGS= -Wall -g `pkg-config gtkmm-2.0 --cflags`

If you use --libs as well, you import the linker flags, which gcc doesn't really like when you're not linking anything - as the messages you posted indicate. They're also completely unnecessary when compiling the object files - you just need the cflags for that.




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