错误 - 架构 arm64 的 2 个重复符号? [英] Error - 2 duplicate symbols for architecture arm64?
问题描述
我有一个 BConstants.h
文件,我在其中放置了项目的所有常量.文件如下:
I have a BConstants.h
file where I put all the constants for my project. The file is the following:
#ifndef asdf_BConstants_h
#define asdf_BConstants_h
typedef NS_ENUM(NSUInteger, BTheme) {
kField
};
typedef NS_ENUM(NSUInteger, BItem) {
kBox
};
typedef NS_ENUM(NSUInteger, BMovementState) {
kTouchUp,
kTouchDown
};
#endif
当我向这个文件添加以下三行时,当文件被#import
ed到另一个.m
文件时,我收到了后续的错误
When I add the following three lines to this file, I receive the subsequent errors when the file is #import
ed to another .m
file
...
NSString * const kHero = @"Hero";
NSString * const kCount = @"Count";
#endif
错误:
duplicate symbol _kHero in:
...list of .o files
duplicate symbol kCount in:
...list of .o files
2 duplicate symbols for architecture arm64
我查看了已经发布在 SO 上的问题,指出我的 compile 源
应用程序 target
中可能有重复的文件,但我检查了,没有发现重复文件.这个问题还可能来自哪里,是否是 BConstants.h
文件中包含这两个 NSString 常量?
I have looked at questions already post on SO that state I may have duplicate files in my compile sources
of the application target
, but I checked and I found no duplicate files. Where else can this problem stem from, is it the inclusion of those 2 NSString constants in the BConstants.h
file?
推荐答案
这个错误除了重复文件还有 2 种可能
There are 2 other possibilities for this error besides duplicate files
- 您可能错误地导入了 .m 文件而不是 .h
- 常量 kHero 和 kCount 已经在其他一些文件中定义.作为您在常量文件中定义这些常量然后只需导入Prefix.pch 文件中的该文件并从其他任何地方删除.
这篇关于错误 - 架构 arm64 的 2 个重复符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!