0

I have a school project to do and I have a problem with my Makefile and the library.

This is my Makefile :

#Makefile                                                 
CC = gcc
CFLAGS = -g -Wall -Wextra `pkg-config --cflags gtk+-3.0`
LDLIBS = `pkg-config --libs gtk+-3.0` -lm -Wl,-V

SRC = main
VEH = $(patsubst %.c, %.o, $(wildcard Vehicules/*.c))
TRL = $(patsubst %.c, %.o, $(wildcard TrafficLights/*.c))
GRA = $(patsubst %.c, %.o, $(wildcard Graph2/*.c))
UI = $(patsubst %.c, %.o, $(wildcard UI/*.c))
OBJ = ${VEH} ${TRL} ${GRA} ${UI} ${SRC}.o

all: ${SRC}

$(SRC): $(OBJ)
        $(CC) $(LDLIBS) $^ -o $@

%.o : %.c
        $(CC) $(LDLIBS) $(CFLAGS) -o $@ -c $<

.PHONY: clean

clean:
        ${RM} ${OBJ} ${SRC} *~ *#

#END

And I tried everything but I just can't debug my undefined reference to all the GTK library. My terminal tells me this :

make: *** [Makefile:19 : main] Error 1

And the line 19 is this one :

$(CC) $(LDLIBS) $^ -o $@

I don't know where is the fault... Please help me :) Thanks in advance !

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108

0 Answers0