xcode – 使用CPP定义构建pch文件时出错

xcode – 使用CPP定义构建pch文件时出错,第1张

概述我们正在为我们的iPhone应用添加CoreData支持.这是一个影响深远的变化(从SQLitePersistentObject转移).为了避免分支,我们在#ifdef块中使用新代码运行单个代码行. 当我从我的一个标题(#define CORE_DATA_BUILD)启用此代码时,一切正常.当我创建一个新目标并在那里定义我的预处理器宏时,我在系统头中出现错误.特别; CFBag.h,CFArray 我们正在为我们的iPhone应用添加CoreData支持.这是一个影响深远的变化(从sqlitePersistentObject转移).为了避免分支,我们在#ifdef块中使用新代码运行单个代码行.

当我从我的一个标题(#define CORE_DATA_BUILD)启用此代码时,一切正常.当我创建一个新目标并在那里定义我的预处理器宏时,我在系统头中出现错误.特别; CFBag.h,CFArray.h,CFBinaryHeap.h,CFDictionary.h和CFSet.h都无法编译.

错误是:

expected ';',',' or ')' before '>' token

我通过复制现有的应用程序目标然后将CORE_DATA_BUILD添加到GCC-4.2的预处理器定义部分 – 预处理来创建新目标.

我很确定预处理器定义已设置,我的宏名称不会与任何Apple符号冲突.当我将我的定义添加到“未在预编译标题中使用的预处理器宏”时,错误也会出现.我已经清理了构建并删除了预编译的头文件,但我仍然收到错误.

Xcode的调用和错误输出是:

ProcesspCH /var/folders/Ay/AyBvIizJERGjIMkWxjcIfU+++TI/-Caches-/com.apple.Xcode.501/Shared@R_722_3013@headers/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/Shared@R_722_3013@headers/UIKit-fzghyhumbyslqcedmtegbkgafwpy/UIKit.h.gch<command-line>: error: macro names must be IDentifIErs<command-line>: error: ISO C99 requires whitespace after the macro nameIn 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 '>' tokenIn file included from /Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator3.0.sdk/System/library/Frameworks/CoreFoundation.framework/headers/CoreFoundation.h:40,etc...

我的Prefix.pch文件是标准的:

//// 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

知道出了什么问题吗?

@H_404_40@解决方法
-D<Multiple -Dvalues> <command-line>: error: macro names must be IDentifIErs<command-line>: error: ISO C99 requires whitespace after the macro name

在某些时候,您似乎编辑了项目或目标的预处理器宏构建设置的所有配置.不同的配置具有不同的值.不是按下取消或统一替换它们,而是以某种方式确认了占位符文本.

Xcode尽职尽责地传递“< Multiple”和“Values>”作为预处理程序定义,而不是您想要的预处理程序定义.

转到目标检查器“构建”选项卡,找到“预处理器宏”,删除其当前值,并将其替换为您真正想要的值.

总结

以上是内存溢出为你收集整理的xcode – 使用CPP定义构建pch文件时出错全部内容,希望文章能够帮你解决xcode – 使用CPP定义构建pch文件时出错所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/998972.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存