help-make
[Top][All Lists]
Advanced

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

RE: My first Makefile HELP!!


From: Dave Korn
Subject: RE: My first Makefile HELP!!
Date: Wed, 14 Mar 2007 18:37:59 -0000

On 14 March 2007 18:05, Jamiil Abduqadir wrote:

> # Flagas
> CFLAGS= -Wall -ggdb3

> #Libraries
> GTKmm_LIBS=`pkg-config gtkmm-2.4 --cflags --libs`

> #Application name
> my_app: $(OBJS)
>         $(CPP) $(LDLIBS) $(OBJS) -o $(EXEC)  $(GTKmm_LIBS)

> main.o: main.cpp
>         $(CPP) $(CFLAGS) -c main.cpp

> helloworld.o: helloworld.hpp
>         $(CPP) $(CFLAGS) -c helloworld.cpp

> This is the error I get:g++ -Wall -ggdb3  -c main.cpp
> main.cpp:1:24: gtkmm/main.h: No such file or directory
> In file included from main.cpp:2:
> helloworld.hpp:4:26: gtkmm/button.h: No such file or directory
> helloworld.hpp:5:26: gtkmm/window.h: No such file or directory
> In file included from main.cpp:2:
> helloworld.hpp:7: error: `Gtk' is not a class or namespace
> helloworld.hpp:8: error: `Window' is not a class or namespace
> helloworld.hpp:8: error: invalid base-class specification
> helloworld.hpp:19: error: syntax error before `::' token
> main.cpp: In function `int main(int, char**)':
> main.cpp:6: error: `Gtk' undeclared (first use this function)
> main.cpp:6: error: (Each undeclared identifier is reported only once
> for each
>    function it appears in.)
> main.cpp:6: error: parse error before `::' token
> main.cpp:9: error: parse error before `::' token
> main.cpp:12:2: warning: no newline at end of file
> make: *** [main.o] Error 1


> It looks as if cannot find the gtkmm library,

  No, it looks as if it cannot find the header files.

> however, when I type "#
> pkg-config gtkmm-2.4 --cflags" I get "-DXTHREADS
> -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include
> -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
> -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include
> -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include
> -I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0
> -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include
> -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/pango-1.0
> -I/usr/include/freetype2 -I/usr/include/atk-1.0"         


  Yes, but if you look closely, you haven't done that anywhere in your 
makefile, so none of those options are being passed to the compiler, so it 
can't find the include headers.

> "# pkg-config gtkmm-2.4 --libs" also provides the right data, so... is nto
> that I don't have the libraries installed. 
> 
> What am I doing wrong?

  Getting confused between the header files that need to be #included at 
compile time and the library files that need to be linked with at link time.

  You only used the pkg-config output to set GTKmm_LIBS, and that is only used 
in your final link, not in building the individual files.  You haven't set the 
CFLAGS according to pkg-config at all.  So you probably really want to write it 
like this:


> # Flagas
> CFLAGS= -Wall -ggdb3 `pkg-config gtkmm-2.4 --cflags`

> #Libraries
> GTKmm_LIBS=`pkg-config gtkmm-2.4 --libs`

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

[Prev in Thread] Current Thread [Next in Thread]