![](/img/trans.png)
[英]C++ error: expected primary-expression before ‘.’ token
[英]C++ error: Expected primary-expression before '<<' token
我写了一个非常简单的 C++ 代码,但我不知道为什么会出现这个错误。 谁能帮我?
#include <iostream>
using namespace std;
#define MKSTR( x ) #x
#define concat(a,b) a ## b;
int main () {
int xy = 100;
cout << MKSTR(HELLO C++) << endl;
cout << concat(x,y) << endl; // I am getting an error here
return 0;
}
#define concat(a,b) a ## b;
^
外来的分号。
define
是一个预处理器指令,不需要分号,删除它。
#define concat(a,b) a ## b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.