libtool vs ar for creating a static library (xcode linker)
Creating a static library on Mac 10.5 with xcode via libtool and with ar via the command line both generate a libMainProject.a file however, when trying to use the one generate by libtool to link into a xcode application I end up with multiple message like
"vtable for project1 referenced from开发者_开发问答: _ZTV27project1$non _lazy _ ptr in libMainProject.a(project1.o)"
Using the ar one is totally fine and links correctly. I have tried the addition of the -c option to the libtool while linking but that does not seem to have an impact. So I guess my 2 options are
1) Figure out what is causing the differences in symbols between the ar and libtool version and make the libtool generate the same information.
2) Make xcode use ar instead of libtool to generate the static libs.
Any ideas or suggestions would be appreciated.
Thanks in advance.
I suggest to unarchive the static library with ar
. You will end up with the *.o
files. Then use gobjdump
(you might have to install that yourself from MacPorts/fink/homebrew) to see what's inside the *.o
files and compare the two versions.
精彩评论