我正在尝试使用当前的 C 编译器编译一些旧代码(大约 2003 年的 robocup 足球模拟服务器):
gcc-c++-4.7.2-2.fc17.x86_64
下面的函数会生成此问题主题中的错误。任何有关如何修改函数以消除错误的建议将不胜感激。
int getInt( const std::string& param ) const
{ return rcss::conf::Builder::template get< int >( param ); }
最佳答案
我假设 Builder
是一个类,而 get
是该类的静态模板方法。
关键字template
告诉编译器get
是一个模板方法。但是,gcc
表示,如果模板中尚未包含该关键字,则不应使用该关键字。
因此,删除 template
关键字应该可以使其正常工作。
关于templates - 错误: 'template' (as a disambiguator) is only allowed within templates,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14288333/