我刚接触Objective C,在尝试导入自己定义的类时出现以下错误。
正在使用配置“Debug”构建项目“MusicCube”的目标——(1个错误) cd /Users/varsha_vijay/Downloads/MusicCube setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Xcode3.1.4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Xcode3.1.4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Xcode3.1.4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Xcode3.1.4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk -L/Users/varsha_vijay/Downloads/MusicCube/build/Debug-iphonesimulator -F/Users/varsha_vijay/Downloads/MusicCube/build/Debug-iphonesimulator -filelist /Users/varsha_vijay/Downloads/MusicCube/build/MusicCube.build/Debug-iphonesimulator/MusicCube.build/Objects-normal/i386/MusicCube.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework AudioToolbox -framework CoreGraphics -framework OpenAL -o /Users/varsha_vijay/Downloads/MusicCube/build/Debug-iphonesimulator/MusicCube.app/MusicCube ld: 在 /Users/varsha_vijay/Downloads/MusicCube/build/MusicCube.build/Debug-iphonesimulator/MusicCube.build/Objects-normal/i386/Flight.o 和 /Users/varsha_vijay/Downloads/MusicCube/build/MusicCube.build/Debug-iphonesimulator/MusicCube.build/Objects-normal/i386/EAGLView.o 中发现重复符号 _num_flight_vertices collect2: ld 返回 1 退出状态 ld: 在 /Users/varsha_vijay/Downloads/MusicCube/build/MusicCube.build/Debug-iphonesimulator/MusicCube.build/Objects-normal/i386/Flight.o 和 /Users/varsha_vijay/Downloads/MusicCube/build/MusicCube.build/Debug-iphonesimulator/MusicCube.build/Objects-normal/i386/EAGLView.o 中发现重复符号 _num_flight_vertices collect2: ld 返回 1 退出状态 构建失败(1个错误)
以下是我的程序组织方式。
1.我定义了一个 C 头文件 vertices.h。
#ifndef VERTICES_H
#define VERTICES_H
const int num_flight_vertices = 8;
#endif
2. 我正在将这个头文件导入到我的Flight.h类中
#import "vertices.h"
@interface Flight : NSObject {
3. 我正在将这个Flight.h文件导入到我的EAGLView.h类中
#import "vertices.h"
@interface EAGLView : UIView {
@private
Flight *flight;
我构建这个时,出现了错误。
有人能帮我解决这个问题吗?
谢谢, VJ