链接错误重复符号 _kCHPointerSize 与 CHDataStructure 静态库
我正在尝试在 Xcode 项目中使用 iPhone 的 CHDataStructures 静态库。我将其与 # import "CHDataStructures.h"
一起包含在我的类标头中。但是,当我编译项目时,出现错误:
d: /Users/sam/Desktop/Apps/libCHDataStructures.a(Util.o) 和 /Users/sam/Desktop/Apps/build/Apps.build/Debug-iphonesimulator/Apps.build/ 中重复符号 _kCHPointerSize对象-normal/i386/AppsAppDelegate.o Collect2: ld 返回 1 退出状态 命令 /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 失败,退出代码 1
我正在使用 GCC-4.2 编译器,并且我也尝试过 LLVM GCC 4.2。我还尝试在构建设置中设置 -ObjC
、-all_build
和 -force_build
标志,但无法编译。我还尝试清理目标,并确保目标二进制文件中是否包含静态库。但我无法找出问题所在。有人可以帮忙吗?
I am trying to use the CHDataStructures static library for iPhone in my Xcode project. I included it with # import "CHDataStructures.h"
in my class header. However, when I compile my project I get the error:
d: duplicate symbol _kCHPointerSize in /Users/sam/Desktop/Apps/libCHDataStructures.a(Util.o) and /Users/sam/Desktop/Apps/build/Apps.build/Debug-iphonesimulator/Apps.build/Objects-normal/i386/AppsAppDelegate.o
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
I am using GCC-4.2 compiler and I have tried LLVM GCC 4.2 as well. I also tried with -ObjC
, -all_build
, and -force_build
flags set in the build setting but it is not compiling. I also tried to clean Target, and also make sure with static lib included with target binary or not. But I couldn't figure out the problem. Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在可能已经太晚了,但我刚刚遇到了类似的问题,所以如果它仍然是一个问题,请检查您的导入语句。
看来您可能在
AppDelegate
和Util
类中引用kCHPointerSize
。就我而言,我经常导入相同的
.h
文件。我删除了其中一条导入语句,问题就解决了。Probably far too late now but I just ran into something similar so if it is still an issue, check your import statements.
It looks like you might be referencing
kCHPointerSize
in both theAppDelegate
and yourUtil
class.In my case I had imported the same
.h
file once too often. I removed one of the import statements and the problem was solved.打开Util.h文件,
将该行替换
为
Open Util.h file,
replace the line
with