Mac OS X:尝试将(ld)链接到框架 [英] Mac OS X: trying to link (ld) against a framework

查看:101
本文介绍了Mac OS X:尝试将(ld)链接到框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Mark and Aaron撰写的"Advanced Mac OS X Programming".我无法获得一条终端声明才能正常工作:

I am reading "Advanced Mac OS X Programming" by Mark and Aaron. I can't get one terminal statement to work correctly :

cc -g -o useadd -F./Adder/build -framework Adder useadd.m

cc -g -o useadd -F./Adder/build -framework Adder useadd.m

在第45页-第3章(库)中.如您所见,我正在尝试将useadd.m链接到使用Xcode创建的框架.当我运行此命令时,出现此错误:

It's on page 45 - Chapter 3 (Libraries). As you can see, I am trying to link useadd.m against a framework created using Xcode. When I run this command, I get this error :

ld:找不到框架加法器

ld: framework not found Adder

collect2:ld返回1个退出状态

collect2: ld returned 1 exit status

我确保文件夹/Adder/build位于当前目录下.在该文件夹中,还有一个文件夹:Adder.build,其中包含框架.我一直在尝试所有可能的组合,但链接器只是找不到我的框架.

I made sure that the folder /Adder/build exists under the current directory. Inside that folder, there is another one : Adder.build that contains the framework. I have been trying every possible combination, but the linker just can't find my framework.

我使用的是Mac OS X Leopard,我认为这本书是在Leopard之前出版的,当时Tiger仍是最新的Mac OS.

I am using Mac OS X Leopard, and I think the book was published before Leopard, when Tiger was still the most recent Mac OS.

能帮我吗?

推荐答案

用-F选项指定的路径必须指向包含框架的目录(不在子目录中).因此,如果它确实在其中,请尝试-F./Adder/build/Adder.build.但是通常Xcode将构建产品放在构建目录中的目录名称Debug或Release中. Adder.build仅用于中间生成结果.

The path specified with the -F option has to point to a directory which contains the framework (not in a subdirectory). So try -F./Adder/build/Adder.build, if it's really in there. But usually Xcode puts build products in a directory name Debug or Release in the build dir. The Adder.build is only for intermediate build results.

这篇关于Mac OS X:尝试将(ld)链接到框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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