我经常使用mysql c api,因此将它们链接到我的c项目中,开发了unter xcode。在静态库中链接Mysqllib(MAC OS X.8.4,Xcode 4.6.3)
昨天我试图建立一个静态库来封装一些数据库函数。
但是,如果我尝试建立的lib有发生一些奇怪的错误:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lm
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lm is not an object file (not allowed in a library)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lz
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lz is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
到包括mysqllib下的Xcode,需要将下面的行添加到生成设置IP“其他连接标志” :
-lmysqlclient -lm -lz
据我所知,xcode无法在静态库中使用此链接器标志。
使用正常的命令行程序,它工作正常,我使用它多年。
有没有人有暗示我如何处理这个问题?
在此先感谢
solick