node ninja
node ninja

Reputation: 33056

Duplicate symbol build error in Xcode project

When I try to build my project I get the following error.

ld: duplicate symbol .objc_class_name_GLFunView in /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFunView-7A51E8797CBB3D72.o and /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFunView-7A51E8797CBB3D72.o

What is this error about? How can I track down where the error is? XCode usually highlights the code that has problems, but for this error it's not showing anything? It doesn't have anything to do with Interface Builder does it?

My research indicates that this might be caused by including something twice, but I don't understand how that's possible since I'm not using any #include statements, I'm only using #import statements.

Here's some more of the build output:

Ld build/Debug-iphonesimulator/GLFun.app/GLFun normal i386 cd /Users/gin/Documents/development/GLFun setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk -L/Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator -F/Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator -filelist /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFun.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -framework QuartzCore -o /Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator/GLFun.app/GLFun

Upvotes: 6

Views: 5873

Answers (2)

Mark
Mark

Reputation: 6977

I ran into the same problem today. It turned out to be a typo in an #import statement. I accidentally included the .m file instead of the header:

#include "MyClass.m"

instead of:

#include "MyClass.h"

Upvotes: 23

Lily Ballard
Lily Ballard

Reputation: 185841

My guess is you're @implementing GLFunView twice in the same file (GLFunView.m). Perhaps you meant to implement GLFunView and then implement a category on it, and forgot the category name?

Upvotes: 3

Related Questions