首页 > 解决方案 > error c2007: #define syntax // 注释块中的语法无效?

问题描述

我目前的问题是我的程序即使在 30 分钟前编译也不会编译。

我将一切恢复正常,我的编译器显示错误消息ui.h(62): error C2007: #define syntax。但是在第 62 行根本没有代码,因为有一个注释块。

我试图重建并清除解决方案,但没有任何效果。我使用三种类型的定义。

#define DEFAULT_PATH        "C:\\"
#define IMG_Y               35
#define TXT_COLOR       0x323232

编辑:添加代码

#define IMG_WIDTH           448
#define IMG_HEIGHT          342 
#define IMG_X               96
#define IMG_Y               35

#define DEFAULT_PATH        "C:\\"



/*
 *  Requests a path to save the image at from the user
 */

void function(std::string& file_path) 
{
std::cout<<"Test"<<std::endl;
}

标签: c++compiler-errorsvisual-studio-2017

解决方案


此错误意味着您后面有一个#define没有标识符的。

在您的代码中搜索悬空的#define.

之后也可以发表评论#define

#define //DEFAULT_PATH

推荐阅读