Undefined link in Linux makefile

I want to create my application for Linux, but I cannot get its make file to make it. problems are the static libraries I'm linking to. I get a lot of undefined references to "error messages like:

undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'

or

undefined reference to `cgicc::Cgicc::Cgicc(cgicc::CgiInput*)'

Here is my make file:

CXX = gcc

INCL_CGICC = ../cgicc-3.2.9
INCL_OPENSSL = ../openssl-1.0.0e/include
INCL_LOG4CPLUS = ../log4cplus-1.0.4/include
INCL_BOOST = ../boost_1_46_1
INCLUDES = -I$(INCL_CGICC) -I$(INCL_OPENSSL) -I$(INCL_LOG4CPLUS) -I$(INCL_BOOST)

CXXFLAGS = -Wall -D_LINUX -DVERSNUM=2 -DVERSMAJOR=0 -DVERSMINOR=0 $(INCLUDES)

TARGET = myapp
OBJS = Main.o 

all: $(TARGET)
strip -s $<
mv -f $< release 

$(TARGET): $(OBJS)
$(CXX) -static -o $@ $(OBJS) \
            ../cgicc-3.2.9/cgicc/.libs/libcgicc.a \
            ../openssl-1.0.0e/libssl.a \
            ../openssl-1.0.0e/libcrypto.a \
            ../log4cplus-1.0.4/src/.libs/liblog4cplus.a \
            -ldl -lpthread

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<

The problem is that I have no idea about make files. I just copied the existing one and tried to adjust it. It does not seem to work, and I cannot find a makefile example that includes static libraries.

+5
source share
2 answers

CXX = gcc

gcc, g++, -lstdc++ . , gcc ++ , g++ .

+15

, Makefiles, , Makefile, . autotools, cmake .. , , , .

+3

All Articles