#include <stdio.h>
#include<stdlib.h>
#define TR(m,n,p) m##n##p
int main ()
{
printf("%s\n",TR("abc","xy","yz"));
return 0;
}
这段代码为什么编译不过?
gcc?那好像要定义2个宏,可以看看这个解释http://www.cnblogs.com/wb-DarkHorse/p/3588787.html
应该能编译过呀,你那边报的错误是什么?
In function ‘main’:
define.c:7:19: error: pasting ""abc"" and ""xy"" does not give a valid preprocessing token
printf("%s\n",TR("abc","xy","yz"));
^
define.c:3:20: note: in definition of macro ‘TR’
#define TR(m,n,o) m##n##o
^
define.c:7:25: error: pasting ""xy"" and ""yz"" does not give a valid preprocessing token
printf("%s\n",TR("abc","xy","yz"));
^
define.c:3:23: note: in definition of macro ‘TR’
#define TR(m,n,o) m##n##o