为什么使用XCode 4为我的iPhone项目构建静态库时出现此错误? [英] why do I get this error building a static library for my iPhone project using XCode 4?

查看:53
本文介绍了为什么使用XCode 4为我的iPhone项目构建静态库时出现此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的iPhone应用程序,我只是想用代码制作一个静态库,以便可以由一个单独的测试应用程序(在工作空间内)使用它.应用程序编译正常,但是当我尝试编译库版本(具有相同的代码文件)时,出现以下错误:

I have an existing iPhone application, and I just wanted to make a static library out of the code, so that I can use it by a separate test application (within the workspace). The application compiles fine, but when I try to compile the library version (which has the same code files) I get the following error:

  • 词汇或预处理器问题-找不到"MyClass.h"文件

但是,即使出现此错误,应用程序仍然可以运行.实际上,当我编译应用程序(使用静态库)时,它最初没有出现错误,然后在一两秒钟后出现上述错误.

However, the application still runs, even through there is this error. In fact when I compile the application (which uses the static library) it initially says no errors, and then after a second or two the above mention error then appears.

我基本上是在做:

  1. 使用Coco Touch静态库在项目中创建新目标
  2. 将.m文件添加到目标编译源"中
  3. 在目标复制标题"中添加.h文件
  4. 在使用库链接二进制文件"中添加相同的库集
  5. 进入个人资料并将目标修改为发布

有什么建议吗?我在这里错过了一步吗?

Any suggestions? Am I missing a step here?

推荐答案

因此,问题出在我在其他链接标志"选项中设置了"-ObjC",我将其放置在一个位置尝试使事情正常进行的阶段,我读了这是必需的-Dereks建议在此处查看编译日志的建议很好

So, the issue turned out to be I had "-ObjC" set in the "Other Link Flags" option, which I'd put there as at one stage trying to get things working I read this was required - Dereks advice to review the compilation log worked well here

这篇关于为什么使用XCode 4为我的iPhone项目构建静态库时出现此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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