Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 873
node ninja Avatar asked Jul 31 '10 05:07

node ninja


People also ask

What does 1 duplicate symbol for architecture x86_64 mean?

duplicate symbol _OBJC_IVAR_$_BLoginViewController._hud in: 17 duplicate symbols for architecture x86_64. "Means that you have loaded same functions twice. As the issue disappear after removing -ObjC from Other Linker Flags, this means that this option result that functions loads twice:"

What is a duplicate symbol?

Duplicate symbols occur when you have both added an implementation file (. cpp) to your project and #included it. This way, the implementation file (. cpp) gets compiled twice: once as a module in your project (as it is added to your project) and subsequently as a piece of #included code.


1 Answers

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"
like image 96
Mark Avatar answered Sep 30 '22 02:09

Mark