【发布时间】:2016-03-20 23:35:13
【问题描述】:
我想使用 C++ 预处理器连接器。
#include <iostream>
#include <string>
#define GetBlack(colorName) (color.##colorName)
struct Color
{
int black = 0;
};
int main()
{
Color color;
int c = color.black;
int d = GetBlack(black);
}
我得到的错误是
5:35:错误:粘贴“.”并且“黑色”没有给出有效的预处理令牌
16:11:注意:在宏“GetBlack”的扩展中
C++Shell:
http://cpp.sh/3547x
有什么建议吗?
【问题讨论】:
标签: c++ concatenation c-preprocessor