How can my XCode project files be exactly the same as a working project and still have build errors?
I'm following a tutorial from chapter 12 of the book "Beginning iPhone 3 Development." When I try to build the project I get an error. The book came with the project files, so I went through every file in my Classes directory and copied and pasted the code from the example project so that they are identical. This has solved my build errors in the past. I checked that the same frameworks were installed and the files in the Other Sources and Resources folder开发者_如何转开发 are identical. Still, when I try to build, I get the following build error:
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
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
From what I can see my project is identical to the one supplied with the book, which I can build and run successfully. What could possibly still be different that is causing this error?
Use diff(1) between the two projects' project.pbxproj files and find out.
Clean the project then try again, sometimes strange things happen. Check the build configurations between the two projects to see if they have any differences (building for the same architecture, sdk, etc.). Since you have duplicate symbols my first guess would be that Clean will solve your issue.
精彩评论