]
#define ttt int
ttt a;
typedef struct d
{
int x;
int y;
}int_data;
typedef struct c
{
float x;
float y;
} float_data;
#define mytype(tt) tt##_data
mytype(ttt) uu;
会报告这样的错误
Compiling...
main.cpp
F:\AaronLiu\Project\test\main.cpp(25) : error C2146: syntax error : missing ';' before identifier 'uu'
F:\AaronLiu\Project\test\main.cpp(25) : error C2501: 'ttt_data' : missing storage-class or type specifiers
F:\AaronLiu\Project\test\main.cpp(25) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\main.sbr': No such file or directory
Error executing bscmake.exe.
test.exe - 4 error(s), 0 warning(s)
如果将最后一句改为
mytype(int) uu;
就没有错误了
【】