0

I am trying to build a shared object(libCalc.so) that depends on a static library(libMath.a)

Static libary is built using

g++ -c math.cpp -Wall -fPIC ar rcs libMath.a *.o

Shared object is built using

g++ libCalc.cpp -std=c++0x -Wall -g -fPIC -c -o ./libCalc.o

g++ -shared -L/path/to/lMath/ -lMath -o libCalc.so libCalc.o

Both of them builds successfully, but after building the shared object when I run "nm" on the libCalc.so, I see some undefined references that are from the static library.

Shouldn't the symbols of libMath.a be defined in libCalc.so? Can someone please explain. How can I create libCalc.so with all the symbols from libMath.a

Thanks

jaakash
  • 173
  • 1
  • 10

0 Answers0