|
From: | Jamiil Abduqadir |
Subject: | Re: My first Makefile HELP!! |
Date: | Wed, 14 Mar 2007 15:28:05 -0400 |
On 2007-3-14 18:04 UTC, Jamiil Abduqadir wrote:
>
> CPP=g++
[...]
> CFLAGS= -Wall -ggdb3
BTW, it would be more conventional to use these names:
CXX=g++
CXXFLAGS= -Wall -ggdb3
Usually $(CPP) refers to the C preprocessor. See
"Variables for Specifying Commands" and
"Variables Used by Implicit Rules"
in the 'make' manual for common usages that others might assume.
> GTKmm_LIBS=`pkg-config gtkmm-2.4 --cflags --libs`
'make' doesn't treat backquotes as special.
If you want to run that command only once, try:
GTKmm_LIBS:=$(shell pkg-config gtkmm-2.4 --cflags --libs)
The real problem is that gtk options are passed to the linker:
> OBJS = main.o helloworld.o
> my_app: $(OBJS)
> $(CPP) $(LDLIBS) $(OBJS) -o $(EXEC) $(GTKmm_LIBS)
...but not to the compiler:
> main.o: main.cpp
> $(CPP) $(CFLAGS) -c main.cpp
so the compiler doesn't know where gtk's headers are:
> This is the error I get:g++ -Wall -ggdb3 -c main.cpp
> main.cpp:1:24: gtkmm/main.h: No such file or directory
because it needs these '-I' options:
> It looks as if cannot find the gtkmm library, 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 don't really use pkgconfig, but I guess it would work if
you added something like this:
CFLAGS+=$(shell pkg-config gtkmm-2.4 --cflags)
right after your original definition of $(CFLAGS).
[Prev in Thread] | Current Thread | [Next in Thread] |