Xcode 3.1.1和静态库 [英] Xcode 3.1.1 and static libraries

查看:81
本文介绍了Xcode 3.1.1和静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位经验丰富的VS.NET用户,并试图在Xcode 3.1.1上启动并运行.
这是我要完成的工作:

I'm an experienced VS.NET user and trying to get up and running on Xcode 3.1.1.
Here's what I'm trying to accomplish:

我希望静态库("Lib")具有自己的xcodeproj文件.我将使用Lib来引用Lib的xcodeproj文件的可执行应用程序("App"),以便对Lib进行更改会导致App重新链接.理想情况下,我希望能够在App的Xcode工作区中编辑Lib的源文件,这样我就不必一直花时间进行更改.

I'd like a static library ("Lib") to have its own xcodeproj file. I'd an executable application ("App") that makes use of Lib to reference Lib's xcodeproj file so that changes to Lib cause App to relink. Ideally, I'd like to be able to edit Lib's source files inside App's Xcode workspace so I don't have to task around all the time to make changes.

我从联机帮助中发现,只需将静态lib xcodeproj拖到我的应用程序的项目中,它就会获得引用.我看到,一旦我的静态库xcodeproj进入了我的应用程序项目中,我就可以将其拖动到该应用程序的目标,并且它知道该应用程序依赖Lib.这似乎是正确的道路,但是事情并没有按照我想要的方式进行.

I figured out from the online help that I can simply drag the static lib xcodeproj in to my app's project and it gets the reference. I see that once my static lib xcodeproj is in my app's project, I can simply drag it to the App's target and it understands that App depends on Lib. This seems like the right path, but things aren't quite working the way I'd like yet.

这是我的问题:

  1. 似乎仅仅让App依赖Lib并不会导致App与Lib链接.看来我必须将libLib.a从Lib文件夹中明确拖到App的使用库链接二进制文件"构建阶段.在VS.NET中,只需将项目指定为解决方案依赖项即可将其添加到链接行.我只是想确保自己没有遗漏任何东西.

  1. It seems that simply having App depend on Lib doesn't cause App to link with Lib. It seems that I have to explicitly drag libLib.a from the Lib folder into App's "Link Binary With Libraries" build stage. In VS.NET, simply specifying the project as a solution dependency adds it to the link line. I just want to make sure I'm not missing anything.

当我在Xcode中打开App并将Lib.xcodeproj拖到其中时,那里没有Lib的任何源文件.我只能在"Lib.xcodeproj"文件夹下找到libLib.a.在VS.NET中,我可以在那里编辑Lib的源文件并重建它,等等.但是在Xcode中,使用这种方法,对Lib.cpp的更改不会导致我在重建App时重建Lib.理想情况下,当我将Lib.xcodeproj拖到App中时,我会得到所有Lib的源文件和目标.有什么办法吗?

When I have App open in Xcode and I drag Lib.xcodeproj into it, I don't get any of Lib's source files there. I only get libLib.a under the "Lib.xcodeproj" folder. In VS.NET, I can edit Lib's source files right there and rebuild it, etc... but with this approach in Xcode, changes to Lib.cpp don't cause Lib to rebuild when I rebuild App. Ideally, I'd get all of Lib's source files and targets to show up when I drag Lib.xcodeproj into App. Is there any way of doing this?

在此先感谢您的答复!

推荐答案

您正确的是,使目标A依赖目标B(无论是在同一项目内还是跨项目)都不会不会导致目标A链接到目标B.您需要明确指定它们;这是因为它们是独立的概念,并且您可能不想彼此链接的目标之间存在依赖关系-例如,由目标C和用作目标A构建过程的一部分.

You're correct that making target A depend upon target B (whether within the same project or across projects) does not cause target A to link against target B. You need to specify them distinctly; this is because they're separate concepts, and you might have dependencies between targets that you don't want to link to each other — for example, a command-line tool that gets built by target C and is used as part of the build process for target A.

此外,您正确的是从项目A内引用项目B不会让您在项目A的窗口中看到项目B的源代码.这是因为Xcode与Visual Studio和Eclipse没有相同的工作区"模型.您上面暗示了包含项目A的工作空间"的存在,但是Xcode并没有任何真正的东西,只是一个窗口代表项目A.

Also, you're correct that referencing project B from within project A will not let you see project B's source code in project A's window. That's because Xcode does not have the same "workspace" model that Visual Studio and Eclipse do; you above alluded to the existence of "a workspace containing project A" but Xcode doesn't really have any such thing, just a window representing project A.

这篇关于Xcode 3.1.1和静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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