I want to compile a program which is using threads. I use the #include <pthread.h>
library, however when I compile it using my make file I get the following errors:
file.c:(.text+0x378): undefined referece to `pthread_create`
file.c:(.text+0x3ad): undefined referece to `pthread_join`
The program run fine with the normal gcc
compilator using -lpthread
flag
The source of the make file that I am using:
CC=gcc
COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c
LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -lpthread
CFLAGS = -Wall -O -I$(dir $(LIBLAB))
TEMPFILES = core core.* *.o temp.* *.out typescript*
all:
@echo "Please compile directly the intended programs by name"
clean:
rm -f ${TEMPFILES}
I have set the -lpthread
flag in the make file but is not working, what changes should I make in the make file?