如何链接到Xcode中的特定框架版本? [英] How to link to a specific framework version in Xcode?

查看:89
本文介绍了如何链接到Xcode中的特定框架版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与OS X的Python.framework链接的应用程序.由于Snow Leopard已升级到Python 2.6,因此该框架现在包含2.4、2.5和2.6的版本.但是,我的程序似乎不想链接到2.6,当我尝试使用较新的Python运行时中的功能时,最终会导致错误.

I've got an application that links against OS X's Python.framework. Since Snow Leopard has upgraded to Python 2.6, the framework now contains versions for 2.4, 2.5, and 2.6. My program doesn't seem to want to link against 2.6, though, and this ends up causing errors when I try and use features from the newer Python runtime.

我知道我可以在构建后的步骤中使用install_name_tool更改链接,但是有什么方法可以简单地告诉它在构建过程中链接的位置吗?似乎是一个非常常见的用例.

I know I can just use install_name_tool to change the linking in a post-build step, but is there any way to simply tell it where to link during the build? Seems like a pretty common use case.

推荐答案

我还没有尝试过,但是我相信它会起作用.

I have not tried this, but I believe it will work.

1)不要将框架添加到您的Xcode项目中

1) Do NOT add the framework to your Xcode project

2)相反,请使用"OTHER_LINKER_FLAGS"中库的完整路径-即"/System/Library/Frameworks/Python.framework/2.5/Python"

2) Instead, use the full path to the library in "OTHER_LINKER_FLAGS" - so "/System/Library/Frameworks/Python.framework/2.5/Python"

3)您还需要将框架搜索路径设置为"/System/Library/Frameworks/Python.framework/2.5/",并将包含搜索路径设置为"/System/Library/Frameworks/Python.framework"/2.5/标题"

3) You'll also want to set the framework search path to "/System/Library/Frameworks/Python.framework/2.5/" and set the include search path to "/System/Library/Frameworks/Python.framework/2.5/Headers"

尽管如此,它会让您容易受到Apple可能做出的任何更改的影响.例如,如果以后再从框架中删除2.5,一切都会中断.最好只更新您的应用程序以使其与当前版本的Python兼容,这是一个更好的主意.

However, with all that said, it will leave you vulnerable to any changes Apple may make. For example, everything will break if they later remove 2.5 from the framework. It'd be a much better idea to just update your app to work with the current version of Python.

这篇关于如何链接到Xcode中的特定框架版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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