clang : error : undefined reference to

514 views Asked by At

/************************/

incapAche.h

...
#ifdef INCaPACHE_2_1
...
extern int no_response_threads[];
...
#endif
...

/***************************/

threads.c 

#include "incApache.h"

#ifdef INCaPACHE_2_1
int client_sockets[MAX_CONNECTIONS]; 
int no_response_threads[MAX_CONNECTIONS];
#endif
....

/*************************/

main.c

#include "incApache.h"
...

#ifdef INCaPACHE_2_1
    no_response_threads[i] = 0;
#endif

....

/******************************************/

Makefile

CC=clang 
CFLAGS= -DHTML_404='"404_Not_Found.html"' \
    -DHTML_501='"501_Method_Not_Implemented.html"' \
    -DIMAGE='"uncadunca.jpg"' \
    -DSTYLE='"000_style.css"' \
    -DPRETEND_TO_BE_ROOT \
    -DINCaPACHE_2_1 \
    # -DDEBUG -g \
    -g3 -O0 -Wall -pedantic 
OBJS=aux.o http.o main.o threads.o
BIN_DIR=bin
EXE=$(BIN_DIR)/incapache

.PHONY: clean tgz-students tgz-full

all: $(EXE)

$(EXE): $(OBJS) $(BIN_DIR)
   $(CC) $(CFLAGS) -o $(EXE) $(OBJS) -lpthread
   sudo chown root $(EXE)
   sudo chmod u+s $(EXE)

aux.o: aux.c incApache.h
http.o: http.c incApache.h
main.o: main.c incApache.h
threads.o: threads.c incApache.h

But i get this linking error main.c:(.text+0x5b2): undefined reference to `no_response_threads' clang: error: linker command failed with exit code 1 , I can t figure out why

0

There are 0 answers