freetype
[Top][All Lists]
Advanced

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

Re: [ft] Included header files location


From: Werner LEMBERG
Subject: Re: [ft] Included header files location
Date: Tue, 23 Dec 2014 09:00:12 +0100 (CET)

> $ freetype-config --ftversion
> 2.5.2

OK, this means new FreeType header file layout.

> $ freetype-config --cflags
> -I/usr/include/freetype2
> 
> #Makefile:
> INCLUDE=-I/usr/include/freetype2  -I/usr/include/freetype2/confg
> CC=g++
> LDLIBS=-lglut -lGLEW -lGL
> all: main
> clean:
> rm -f *.o main
> .PHONY: all clean

Uh, oh, this is not the way you should use `freetype-config'.  The
right solution is to let the `make' program do the work since you
obviously don't use GNU autotools or something similar for creating a
`configure' script.  I *strongly* suggest that you get more
information on how Makefiles should be written.

One possible solution:

  INCLUDE=`freetype-config --cflags`

Note that the `--cflags' option returns *all* header include paths for
FreeType.  It's thus completely unnecessary to manually include
another header directory.  BTW, have you noted the typo `confg'?

> #include <ft2build.h>
> #include FT_FREETYPE_H

This is OK.

> $ make
> g++     main.cpp  -lglut -lGLEW -lGL -o main

Soo...  Where is the rule to pass your `INCLUDE' variable to g++?
Assuming that you use GNU make, a call

  make -p | less

shows the complete database the `make' program uses to construct
implicit rules in case there are no explicit ones.  A search for `g++'
leads to the variable `CXX' – you should *not* abuse `CC' for a C++
compiler.  And a search for an `INCLUDE' variable yields nothing: It's
simply not used!

To solve the mystery: Rename `INCLUDE' to `CPPFLAGS' (valid for both
`CC' and CXX'), and it should work.

For the future, I suggest that you use *explicit* rules to avoid such
unpleasant surprises.  Even better, use Makefile generator programs
like `autotools' or `cmake', which makes all this stuff much easier.


    Werner

reply via email to

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