iPhone 응용 프로그램에 CoreData 지원을 추가하고 있습니다. SQLitePersistentObject에서 옮겨가는 것은 먼 미래의 변화입니다. 분기를 피하기 위해 우리는 #ifdef
블록 안에 새로운 코드로 단일 코드 라인을 실행합니다.CPP 정의로 pch 파일을 생성하는 중 오류가 발생했습니다.
내 헤더 (#define CORE_DATA_BUILD) 중 하나에서이 코드를 활성화하면 모든 것이 잘 동작합니다. 새 대상을 만들고 거기에 내 전 처리기 매크로를 정의하면 시스템 헤더에 오류가 발생합니다. 구체적으로; CFBag.h, CFArray.h, CFBinaryHeap.h, CFDictionary.h 및 CFSet.h 모두 컴파일에 실패합니다.
오류 :
expected ';', ',' or ')' before '>' token
내가 내 기존 응용 프로그램의 대상을 복사 한 후 GCC-4.2의 C 전 프로세서 정의 섹션에 CORE_DATA_BUILD을 추가하여 나의 새로운 목표를 만들어 - 전처리.전 처리기 정의가 설정되어 있고 매크로 이름이 Apple 기호와 충돌하지 않는다고 확신합니다. 또한 "Preprocessor Macros Not Used Precompiled Headers"에 정의를 추가 할 때 오류가 나타납니다. 빌드를 지우고 미리 컴파일 된 헤더를 제거했지만 여전히 오류가 발생합니다.
은 엑스 코드에서호출 및 오류 출력은 : 잘못된 무슨
// // Prefix header for all source files of the 'Groove' target in the 'Groove' project // #ifdef __OBJC__ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #endif
어떤 생각 :
ProcessPCH /var/folders/Ay/AyBvIizJERGjIMkWxjcIfU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/UIKit-fzghyhumbyslqcedmtegbkgafwpy/UIKit.h.gch /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h normal i386 objective-c com.apple.compilers.gcc.4_2 cd /Users/rog/Development/Groove 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 -x objective-c-header -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Werror -Wreturn-type -Wunused-variable -DCOREDATA -D<Multiple -Dvalues> -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -fvisibility=hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/Tests-generated-files.hmap -I/Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/Tests-own-target-headers.hmap -I/Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/Tests-all-target-headers.hmap -iquote /Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/Tests-project-headers.hmap -F/Users/rog/Development/Groove/build/Debug-iphonesimulator -F/Users/rog/Development/Groove -I/Users/rog/Development/Groove/build/Debug-iphonesimulator/include -I/Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/DerivedSources/i386 -I/Users/rog/Development/Groove/build/Groove.build/Debug-iphonesimulator/Tests.build/DerivedSources -c /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h -o /var/folders/Ay/AyBvIizJERGjIMkWxjcIfU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/UIKit-fzghyhumbyslqcedmtegbkgafwpy/UIKit.h.gch <command-line>: error: macro names must be identifiers <command-line>: error: ISO C99 requires whitespace after the macro name In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:39, from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6, from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8, from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h:173: error: expected ';', ',' or ')' before '>' token /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h:359: error: expected ';', ',' or ')' before '>' token In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:40, etc...
내 Prefix.pch 파일은 표준?
Doh, 나는 완전히 그것을 기억하지 못했다 .-- (대단히 감사합니다. 어떻게 그 일을했는지는 잘 모르겠지만, 오늘 빠르게 조사하고 있습니다. COREDATA 매크로를 삭제하려고 할 때 Xcode가 설정을 덮어 쓰지 않고 있다는 것을 알았습니다. –
고마워요. 문제가 있습니다. 근본 원인은 다른 구성에 대해 다른 값이있을 때 모든 구성에 대해 Xcode에 컴파일러 플래그를 추가하는 것 같습니다. 예를 들어 디버그 빌드에만 DEBUG를 정의한 다음 COREDATA 모든 구성에서 Xcode는 표시 문자열을 컴파일러 호출에 사용 된 실제 값으로 변환하고 사용자가 지적한 결함을 생성합니다. –