user248230
user248230

Reputation: 111

C code compilation failure

i have this makefile below and in it my includes are

gtk/gtk.h

and

webkit/webkit.h

but when i try to build the project using the make command i have the errors

error: gtk/gtk.h: No such file or directory

error: webkit/webkit.h: No such file or directory

in case the gtk+-2.0.pc and webkit...pc are in the usr/lib/pkgconfig

Make File:

CC=gcc
CFLAGS=-g -Wall `pkg-config --cflags gtk+-2.0 webkit-1.0`
LDFLAGS+=`pkg-config --libs gtk+-2.0 webkit-1.0`
INCLUDE=/usr/include
LIB=/usr/lib
SOURCES=wrapper.c wrapper.h browser.c
OBJ=browser

all:  $(SOURCES) $(OBJ)

$(OBJ): $(SOURCES)
 $(CC) $(CFLAGS) $(LDFLAGS) -I $(INCLUDE) -L $(LIB) $(SOURCES) -o $(OBJ)

clean:
 rm -rf $(OBJ)

Upvotes: 3

Views: 2017

Answers (4)

Dmitry Yudakov
Dmitry Yudakov

Reputation: 15734

Do you actually have gtk/gtk.h and webkit/webkit.h in /usr/include directory? Are the development packages providing them installed?

Upvotes: 1

Clifford
Clifford

Reputation: 93466

The only include path you have specified is /usr/include, therefore it will look fo rthe files at:

/usr/include/gtk/gtk.h
/usr/include/webkit/webkit.h

Unless you have additional paths specifies in the either of the CPATH, or C_INCLUDE_PATH environment variables.

Add usr/lib/pkgconfig as a -I path.

Upvotes: 1

jamessan
jamessan

Reputation: 42647

Backticks aren't how you run shell commands in a Makefile. Your CFLAGS and LDFLAGS lines should probably look like

CFLAGS=-g -Wall $(shell pkg-config --cflags gtk+-2.0 webkit-1.0)
LDFLAGS+=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)

Upvotes: 6

Michael Daum
Michael Daum

Reputation: 830

Try setting CXXFLAGS in addition to CFLAGS.

Upvotes: 1

Related Questions