Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 534
user248230 Avatar asked Aug 16 '26 10:08

user248230


2 Answers

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)
like image 118
jamessan Avatar answered Aug 19 '26 00:08

jamessan


Try setting CXXFLAGS in addition to CFLAGS.

like image 38
Michael Daum Avatar answered Aug 19 '26 00:08

Michael Daum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!