我有下面的代码-
void CommandProcessor::ReplacePortTag((void *) portID)
{
std::string temp = std::string.empty();
int start = 0;
for (int i=0; i<CommandProcessor::fileContents.length(); i++)
{
if (CommandProcessor::fileContents.substr(i,6) == "<port>")
{
temp += CommandProcessor::fileContents.substr(start,i-start);
temp += portID;
start = i+6;
}
}
temp += CommandProcessor::fileContents.substr(start+6,CommandProcessor::fileContents.length()-start-6);
CommandProcessor::fileContents = temp;
}当我试图编译时,我得到了错误-
error C2448: 'CommandProcessor::ReplacePortTag' : function-style initializer appears to be a function definition我不知道我哪里出了问题。我要修改什么来修正这个错误?
发布于 2014-08-18 12:34:03
此语法意味着您是C风格的将变量portID转换为void*
void CommandProcessor::ReplacePortTag((void *) portID)如果参数应该是void*,则函数声明应该是
void CommandProcessor::ReplacePortTag(void* portID)https://stackoverflow.com/questions/25363394
复制相似问题