Xcode的linker(连接器)的other linker flags相关配置问题

本文详细介绍了如何使用Xcode创建项目目标及配置,并解析了ld命令选项中关于静态库加载的方法,包括-all_load、-ObjC和-force_load等参数的使用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、通过命令行查看 man /user/bin/ld


截取常用内容如下:

Options that control libraries

     -all_load   Loads all members of static archive libraries.


     -ObjC       Loads all members of static archive libraries that implement an Objective-C class or category.


     -force_load path_to_archive

                 Loads all members of the specified static archive library.  Note: -all_load forces all members of all archives to be loaded.  This option allows

                 you to target a specific archive.



二、参考苹果官方文档:Xcode_build_System

截取相关内容如下:

Creating Targets

When you create a project from one of the Xcode project templates, Xcode automatically creates a target foryou. If, however, your project needs to contain more than one target—usually because you are creating morethan one product—you can also add targets to an existing project.

If you are adding targets to your project, chances are you’ve already made a number of decisions about producttype, programming language, and framework. Xcode provides a number of target templates to support yourchoices. The selection of target templates is similar to the selection of project templates. The target specifiesthe target’s product type, a list of default build phases, and default definitions for some build settings. A targettemplate typically includes all build settings and build phases required to build an instance of the specifiedproduct. Unlike the project templates provided by Xcode, the target templates do not specify any default files;you must add files to the target yourself, as described in Managing Target Files (page 28).

Note: Targets created with target templates have no framework references. Any frameworks orlibraries that the target is configured to link with are added to the Other Linker Flags build setting.You can add framework references to the target yourself, as described in Figure 1-10 (page 31)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值