错误:“类”之前应为非限定 ID
error: expected unqualified-id before ‘class’
在XVisualInfo结构中,有一个名为class
的属性,当我想在c ++程序中使用此结构时,会出现此问题:
...
XVisualInfo templ;
templ.screen = screen;
templ.depth = 32;
templ.class = TrueColor;
...
当我尝试编译时,我得到以下错误:
error: expected unqualified-id before ‘class’
templ.class = TrueColor;
^~~~~
现在我能做些什么来让它工作?!!
这是
来自/usr/include/X11/Xutil.h
的XVisualInfo的实际定义
typedef struct {
Visual *visual;
VisualID visualid;
int screen;
int depth;
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ */
#else
int class;
#endif
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} XVisualInfo;
如您所见,编写C++代码的规定就在那里。只需使用c_class
成员名称。
相关文章:
- 我不断收到 [错误] ID 返回 1 退出状态错误,但看不到问题所在
- 方法内部但循环仍得到预期的不合格id错误C++
- Xcode 9.4.1 中的 Apple Mach-O 链接器 (id) 错误
- 错误:令牌 { '{' 之前应存在非限定 ID
- DCMTK 了解"DIMSE 没有有效的演示上下文 ID"错误
- C++中的"expected unqualified-id"错误是什么?
- c++ for 循环中预期的非限定 id 错误
- 在"." 令牌之前应为非限定 ID(C++ 错误)
- 预期"{"错误?以及预期的未指定 ID 错误?
- 错误:预期的非限定 ID 错误:含义和修复
- 安卓-NDK-R7C "deque.h"中的非限定 ID 错误
- 预期的不合格id错误,很可能是原因
- 意外的非限定 ID 错误
- C++中类出现预期的不合格id错误
- 出现意外的非限定id错误
- iOS中出现不合格的id错误
- XSLT到HTML的转换.Qt5中的generate-id()错误
- 不合格的id错误和井字游戏板不工作
- 传递结构体数组的预期非限定id错误
- 如何执行项目范围内的唯一id /错误代码,以便在源代码中轻松找到错误的来源