C code compilation failed

I have this makefile below and in it my included

GTK / gtk.h

and

Webkit / webkit.h

but when I try to build a project using the make command, I have errors

error: gtk / gtk.h: There is no such file or directory

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

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

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)
+3
source share
4 answers

Backticks is not 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)
+6
source

Try installing CXXFLAGS in addition to CFLAGS.

+1
source

, , - /usr/include, :

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

, CPATH C_INCLUDE_PATH.

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

+1
source

Do you have gtk / gtk.h and webkit / webkit.h in the / usr / include directory? Are development packages provided for their installation?

+1
source

Source: https://habr.com/ru/post/1735113/


All Articles