I want to use C++ Library in C that's why I wrote a wrapper for C which contains a wr.h, wr.cc, and a test program test.c. So, I wrote a makefile (given below) to create a .so file for my wrapper. But It shows undefined reference to the library. Any suggestion?
PROGRAM = MYWR
INCLUDEDIRS = -I/path/to/include
LIBDIRS = -L/path/to/lib/
LIBS = -labc -lbcd
CXXSOURCES = wr.cc
CSOURCES = test.c
CXXOBJECTS = $(CXXSOURCES:.cc=.o)
COBJECTS = $(CSOURCES:.c=.o)
CXXFLAGS = -g -Wall -std=gnu++11 $(INCLUDEDIRS)
CXX = g++
LDFLAGS = $(LIBDIRS) $(LIBS)
all: $(PROGRAM)
$(PROGRAM): $(CXXOBJECTS) $(COBJECTS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(CXXOBJECTS) $(COBJECTS)
Any Suggestion???
Aucun commentaire:
Enregistrer un commentaire