Reputation: 1333
I've upgraded to Xcode 7 and out of the sudden one of my targets fails to build with "macro name must be an identifier" message. Debug configuration of this target builds just ok and I can run it on the device, but release configuration doesn't build.
The error points to the target's .pch file, but same .pch file builds just ok for many other targets, including those that are release.
Here is the error message:
ProcessPCH /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.pch speedometer/speedometer-Prefix.pch normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/stanislavdvoychenko/Documents/code/speedo export LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c-header -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -gmodules -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCOCOAPODS=1 -DCOCOAPODS=1 -DTAXI -D=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=7.0 -g -fvisibility=hidden -Wno-sign-conversion -I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/taximeter.hmap -I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Products/Release-iphoneos/include -I/Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public -I/Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public/GoogleMaps -I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/DerivedSources/armv7 -I/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/speedo.build/Release-iphoneos/taximeter.build/DerivedSources -F/Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Products/Release-iphoneos -F/Users/stanislavdvoychenko/Documents/code/speedo/Pods/GoogleMaps/Frameworks -F/Users/stanislavdvoychenko/Documents/code/speedo -DNS_BLOCK_ASSERTIONS=1 -isystem /Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public -isystem /Users/stanislavdvoychenko/Documents/code/speedo/Pods/Headers/Public/GoogleMaps -MD -MT dependencies -MF /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.d -c /Users/stanislavdvoychenko/Documents/code/speedo/speedometer/speedometer-Prefix.pch -o /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.pch --serialize-diagnostics /Users/stanislavdvoychenko/Library/Developer/Xcode/DerivedData/speedo-gagyicfwqpzsudcvwgxjqhwbgpte/Build/Intermediates/PrecompiledHeaders/speedometer-Prefix-copscroeimdxfkdvcsfifjmzires/speedometer-Prefix.pch.dia In file included from :334: :4:10: error: macro name must be an identifier #define 1 ^ 1 error generated.
And here is the .pch file:
#import #ifndef __IPHONE_4_0 #warning "This project uses features only available in iOS SDK 4.0 and later." #endif #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "Enums.h" #endif #define APP ((AppDelegate *)[[UIApplication sharedApplication] delegate])
I've tried already the clean and Xcode restart.
I'll be grateful for any pointers for how can I dig deeper and find where the problem is.
Upvotes: 2
Views: 4082
Reputation: 90681
The problem is with the -D=1
command-line option in the compile command. You have a bad value somewhere in your build settings, probably in Preprocessor Macros or Other C Flags.
Upvotes: 8
Reputation: 38162
Whatever content you showed in your .pch
file looks good; it gets compiled correctly for me. However, compiler is complaining for below code where there is no name given for the macro. #define
must be followed by macro name whereas in your statement it is missing. Could you please search for #define 1
statement in your codebase and correct it.
In file included from :334:
:4:10: error: macro name must be an identifier
#define 1
As a side note, please ensure you do not have any pre processor value set for APP
like APP
set to 1
. To rule out, try using a different variable than APP
.
Upvotes: 0