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开发者_StackOverflow社区 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)
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)
Try setting CXXFLAGS in addition to CFLAGS.
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.
Do you actually have gtk/gtk.h and webkit/webkit.h in /usr/include directory? Are the development packages providing them installed?
精彩评论