使用枚举与命名空间有问题。带枚举的命名空间问题
下面是函数调用:
object->writeMessage(tmpZone->getLineOne(), tmpZone->getLine(), tmpZone->getPosition());
从编译器的问题来自
tmpZone->getLine()
的原型函数getline()从区级(这是在洞察命名空间)是:
Line getLine();
它在insight命名空间中返回一个枚举类型。此函数调用位于使用名称空间洞察下的cpp文件中;线。
编译错误是
C:/WindRiver/workspace/SimpleTemplate/InsightLT.cpp:在静态成员 函数
static int insight::InsightLT::taskFunction(insight::InsightLT*)': C:/WindRiver/workspace/SimpleTemplate/InsightLT.cpp:161: error: no matching function for call to
洞察:: InsightLT ::的WriteMessage(的std :: string,线,INT) “ C:/WindRiver/workspace/SimpleTemplate/InsightLT.cpp:82:注意: 候选人是:无效的洞察力:: InsightLT ::的WriteMessage(的std :: string, 洞察::线,INT)
我想不出为什么会发生这种情况。 Zone类也是在insight命名空间中定义的。任何想法家伙?
getLine()函数的原型是什么? –
请提供一个说明错误的完整小例子。 – Oswald
'getPosition()'返回一个'int',或可转换为'int'的东西吗? getLineOne()'返回一个'string',或者可以转换为'string'的东西?你为什么说这个问题来自'getLine()'?我不能从编译器错误 –