设置"OTHER_LDFLAGS"通过命令行使用xcodebuild [英] Set "OTHER_LDFLAGS" through command line with xcodebuild

查看:607
本文介绍了设置"OTHER_LDFLAGS"通过命令行使用xcodebuild的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过command line成功编译了项目.但是我想通过命令行设置library(.a)文件.

I have successfully compiled the project through command line.But i want set library(.a) file through command line .

使用以下命令成功构建 /Users/Mahen/Documents/workspace/TestingApplication/Test/Test.xcodeproj -configuration调试版本

It successfully build with below command /Users/Mahen/Documents/workspace/TestingApplication/Test/Test.xcodeproj -configuration Debug build

现在,我要设置通过命令行链接.a文件. 我尝试将"OTHER_LDFLAGS"选项设置为 -f orce_load /Users/Mahen/Documents/workspace/Test.iOS/build/Debug-iphoneos/libTest.a -lstdc++

Now I want set Linking .a file through command line. I have try set "OTHER_LDFLAGS" option with -force_load /Users/Mahen/Documents/workspace/Test.iOS/build/Debug-iphoneos/libTest.a -lstdc++

但是无法加载, 您能建议通过命令行链接.a文件的正确方法吗?

But it couldn't load , Can you suggest the right way Linking .a files through the command line?

谢谢

推荐答案

我不清楚您的确切问题是什么,但希望其中之一可以帮助您或其他人:

I'm not clear what your exact problem is, but hopefully one of these will help you or somebody else:

要覆盖选项,请转到xcodebuild "OPTIONNAME=newvalue"

xcodebuild "OTHER_LDFLAGS= .... "

注意,这将覆盖您在实际xcode项目中可能拥有的任何其他"OTHER_LDFLAGS".

Note that this will override any other "OTHER_LDFLAGS" that you might have had in the actual xcode project.

要链接库 libNAME.a,您需要在链接器标志-lNAME中添加,并且在库搜索路径-Lpath/to/my/libraries上也要放置libNAME.a.

To link a library libNAME.a you need to include in the linker flags -lNAME and also have the location of libNAME.a on the library search path -Lpath/to/my/libraries.

xcodebuild "OTHER_LDFLAGS=-Liphoneos -lTest"

即使没有依赖性(例如,包含gtest案例)也要强制链接库,那么您需要使用-force_load path/to/my/libraries/libNAME.a

xcodebuild "OTHER_LDFLAGS=-force_load iphoneos/libTest.a"

这篇关于设置"OTHER_LDFLAGS"通过命令行使用xcodebuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆