问题描述:

Yesterday I started working on my iPhone project again. I'm building a game with Cocos2D/Box2d. But when I tried to build the project I got thousands of errors. I couldn't find out what was wrong.

So I created a new project from a Cocos2D template and added only my custom code. Again full of errors when I tried to build for the first time.

The next thing I did was creating a clean new project. Building that gave no problems. So after compiling it one time, I added my custom code and my game was working again! No errors.

I worked on the project for hours without any problems, but due to some changes I made, I needed to Empty the Caches en Clean targets. And after that.. Yes, again thousands of errors.

The code/classes I added did not overwrite any of the libraries, It are just custom classes.

Anyone who can point me in the right direction? I have no clue what's causing the problem.

Gerard

Edit:

There are more than 40.000 errors. Below are some of the errors. They all seem to begin with "expecting".

 Build cocos2d libraries of project Untitled with configuration Debug CompileC "/Developer/Build Folder/Untitled.build/Debug-iphoneos/cocos2d libraries.build/Objects-normal/armv6/FontLabel.o" libs/FontLabel/FontLabel.m normal armv6 objective-c com.apple.compilers.llvmgcc42

cd /Users/m0rph3v5/Desktop/Untitled

setenv LANG en_US.US-ASCII

setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -x objective-c -arch armv6 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -DDEBUG -DCOCOS2D_DEBUG=1 -DCD_DEBUG=1 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -gdwarf-2 -mno-thumb -miphoneos-version-min=3.0 "-I/Developer/Build Folder/Untitled.build/Debug-iphoneos/cocos2d libraries.build/cocos2d libraries.hmap" "-F/Developer/Build Folder/Debug-iphoneos" "-I/Developer/Build Folder/Debug-iphoneos/include" -Ilibs "-I/Developer/Build Folder/Untitled.build/Debug-iphoneos/cocos2d libraries.build/DerivedSources/armv6" "-I/Developer/Build Folder/Untitled.build/Debug-iphoneos/cocos2d libraries.build/DerivedSources" -fvisibility=hidden -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -c /Users/m0rph3v5/Desktop/Untitled/libs/FontLabel/FontLabel.m -o "/Developer/Build Folder/Untitled.build/Debug-iphoneos/cocos2d libraries.build/Objects-normal/armv6/FontLabel.o"

In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:9,

from /Users/m0rph3v5/Desktop/Untitled/libs/cocos2d/ccTypes.h:35,

from /Users/m0rph3v5/Desktop/Untitled/libs/cocos2d/CCAction.h:30,

from /Users/m0rph3v5/Desktop/Untitled/libs/cocos2d/CCActionManager.h:28,

from /Users/m0rph3v5/Desktop/Untitled/libs/cocos2d/cocos2d.h:51,

from /Users/m0rph3v5/Desktop/Untitled/Classes/Block.h:10,

from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:42,

from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:38,

from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,

from /Users/m0rph3v5/Desktop/Untitled/libs/FontLabel/FontLabel.h:22,

from /Users/m0rph3v5/Desktop/Untitled/libs/FontLabel/FontLabel.m:22:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:91: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:92: error: expected ')' before 'allocator'

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:93: error: expected declaration specifiers or '...' before '*' token

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:93: error: 'CFStringRef' declared as function returning a function

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:94: error: expected declaration specifiers or '...' before '*' token

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:94: error: 'Boolean' declared as function returning a function

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:95: error: expected declaration specifiers or '...' before '*' token

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:95: error: 'CFHashCode' declared as function returning a function

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h:97: error: expected specifier-qualifier-list before 'CFIndex'

And the list goes on...

网友答案:

When you ask a question, please, if you want to see the answer, provide us version of the cocos2d and also what compiler version do you use... and so on. Hm, however I think I know what's the problem. You're probably just forget to change the extension of your newly created custom class from ".m" to ".mm".

相关阅读:
Top