Dave Coventry
Dave Coventry

Reputation: 141

g++ header files in include subdirectory

I'm including the freetype2 library by calling the freetype2/ft2build.h header file.

#include <freetype2/ft2build.h>

The header file itself calls another header file in a subdirectory.

#include <config/ftheader.h>

Which causes the 'make' to fail.

/usr/include/freetype2/ft2build.h:37:29: fatal error: config/ftheader.h: No such file or directory
#include <config/ftheader.h>

The 'config' subdirectory is within the 'freetype2', but the compiler is clearly looking for it in the /usr/include directory.

I cannot find a solution to this, but I can't possibly be the only one it affects. What am I missing?

I've tried adding INCLUDE=-I/usr/include/freetype2/config to the makefile but this doesn't work.

Makefile is as follows

INCLUDE=-I/usr/include/freetype2
CC=g++
LDLIBS=-lglut -lGLEW -lGL
all: main
clean:
    rm -f *.o main
.PHONY: all clean

Upvotes: 1

Views: 7703

Answers (2)

Dave Coventry
Dave Coventry

Reputation: 141

Changed my Mkefile.

CPPFLAGS=-I/usr/include/freetype2  -I/usr/include/freetype2/config
CC=g++
LDLIBS=-lglut -lGLEW -lGL
all: main
clean:
    rm -f *.o main
.PHONY: all clean

from INCLUDE to CPPFLAGS.

Upvotes: 0

Palo
Palo

Reputation: 1008

I think you need to replace

#include <freetype2/ft2build.h>

with

#include <ft2build.h>

and use

INCLUDE=-I/usr/include/freetype2

in makefile

Upvotes: 3

Related Questions