0

I'm trying to build my project with the following makefile:

CC=g++
in=main.cpp
out=analyser
series=Series.o
episode=Episode.o
curlandclean=src/htmlfunctions/curlandclean.cpp
pugilib=src/pugixml/src/pugixml.o
curllib=src/libcurl/src/curl
tidylib=src/tidy/tidy-html5-master/lib/libtidy.a
CFLAGS=-c 
C11FLAG=-std=c++11
MTFLAG=-fopenmp -lpthread

$(out): analyser

$(out):$(series) $(episode) curlandclean.o $(curllib) $(tidylib) $(pugilib)
        $(CC) $(in) $(series) $(episode) curlandclean.o $(curllib) $(tidylib)         $(pugilib) $(C11FLAG) -fopenmp -lpthread -o $(out)

curlandclean.o:$(curlandclean)
    $(CC) $(CFLAGS) $(curlandclean)

$(series):src/Series.cpp
    $(CC) $(CFLAGS) $(C11FLAG) $(MTFLAG) src/Series.cpp

$(episode):src/Episode.cpp
    $(CC) $(CFLAGS) src/Episode.cpp

$(curllib):
    cd src/libcurl && ./configure --disable-shared
    cd src/libcurl && $(MAKE)

$(pugilib):
    cd src/pugixml/src && $(CC) $(CFLAGS) pugixml.cpp

$(tidylib):
    cd src/tidy/tidy-html5-master && $(MAKE)

clean: 
    rm *.o

It gets to the final linking stage but comes with lots of 'multiple definition errors':

src/libcurl/src/curl: In function `_fini':
(.fini+0x0): multiple definition of `_fini'

src/libcurl/src/curl: In function `data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0   has invalid symbol index 11

I'm not sure what I've done wrong as I've compiled my intermediate files with the -c output flag.

l0b0
  • 55,365
  • 30
  • 138
  • 223
user3083672
  • 377
  • 1
  • 12

1 Answers1

0

Based on the error message, I'd say that this:

curllib=src/libcurl/src/curl

is a program, not a library. Shouldn't it be something like libcurl.a instead?

MadScientist
  • 92,819
  • 9
  • 109
  • 136