![](/img/trans.png)
[英]C++ error: expected primary-expression before ‘.’ token
[英]C++ error: expected primary-expression before ‘[’ token
现在,我尝试通过dklab安装RealPlexor,但是它会出现错误:
# bash ./Make.sh
In file included from dklab_realplexor.cpp:68:
utils/misc.h: In function ‘void die(std::string)’:
utils/misc.h:105: error: expected primary-expression before ‘[’ token
compilation terminated due to -Wfatal-errors.
这是那条线
s = regex_replace(s, regex("\\$!"), [](smatch s) { return strerrno(); });
说啊
s = regex_replace(s, regex("\\$!"), *(smatch s) { return strerrno(); });
[]
运算符通常用于索引某些内容(例如字符数组),因此C ++希望在其前面有内容
也可以尝试@DavidO的建议:
您使用的是Lambda表达式,该表达式是C ++ 11语法,但可能尚未将编译器设置为识别C ++ 11。 如果使用的是g ++,则应使用-std=c++11
标志。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.