简体   繁体   English

词汇或预处理器问题

[英]Lexical or Preprocessor issue

错误说明

I'm getting these 2 errors whilst archiving the project. 归档项目时出现这两个错误。

  • Macro name is missing 宏名称丢失
  • Macro names must be identifiers 宏名称必须是标识符

Any ideas what's going on? 有什么想法吗?

What it says on the tin. 它在锡罐上说了什么。

The first is #define , if you have this on its own, what is it defining? 第一个是#define ,如果您自己拥有它,它的定义是什么? You need an identifier/name after the #define , such as #define VARIABLE . #define后需要一个标识符/名称,例如#define VARIABLE

The second does provide some sort of name, but it's simply a number. 第二个确实提供了某种名称,但这只是一个数字。 Identifiers cannot start with a number (just like variable names can't). 标识符不能以数字开头(就像变量名不能一样)。 and hence isn't classed as an identifier. 因此未归类为标识符。

I got the same errors when attempting to define preprocessor macros in Build Settings as follows 尝试在“构建设置”中定义预处理器宏时,出现了相同的错误,如下所示

Preprocessor Macros
    DEBUG=1 MY_MACRO = 1

So, the parser does not like spaces, ie MY_MACRO=1 因此,解析器不喜欢空格,即MY_MACRO = 1

You are using macro without giving name . 您正在使用macro而未给出name You've to use #define with name as follows and have to give value for that macro 您必须按以下方式使用#define的名称,并必须为该macro提供值

#define macroname macrovalue

second one is you can't use numbers in macro but you are giving 第二个是你不能在macro使用numbers ,但是你给
#define 0 1

it should be like 它应该像
#define ZERO 1

you are using 0 as a NAME of a macro, a digit is no valid name for any variable, functions or macro. 您将0用作宏的名称,数字对于任何变量,函数或宏均无效。 all identifiers must start with a letter(or _) :) 所有标识符都必须以字母(或_)开头:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 词汇或预处理器问题“#import <map> - Lexical or Preprocessor Issue with "#import <map> 词法预处理器问题(找不到文件) - Lexical Preprocessor issue (File not found) 升级到 Xcode 12 后出现词法或预处理器问题 - Lexical or Preprocessor Issue after upgrade to Xcode 12 词汇或预处理器问题。 - “文件未找到。” - Lexical or Preprocessor issue. - “File not found.” Xcode 10 找不到词法或预处理器问题.h 文件 - Xcode 10 Lexical or preprocessor issue .h file not found 词法或预处理器问题:找不到“MyViewController.h”文件 - Lexical or preprocessor Issue: 'MyViewController.h' file not Found 未找到词法或预处理器问题&#39;FacebookSDK / FacebookSDK.h&#39;文件 - Lexical or Preprocessor Issue 'FacebookSDK/FacebookSDK.h' file not found 找不到词法预处理器问题GooglePlus / GooglePlus.h - lexical preprocessor issue GooglePlus/GooglePlus.h not found 词法或预处理器问题:找不到CoreLocation / CoreLocation.h - Lexical or preprocessor issue: CoreLocation/CoreLocation.h not found xCode 12 Beta 4,词法或预处理器问题 - 未找到 header 文件。 仅模拟器 - 适用于设备 - xCode 12 Beta 4, Lexical or Preprocessor issue - header file not found. Simulator only - works on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM