CPP新手:编译器错误

Ria*_*546 -1 c++

编译失败,输出如下.

请问..

PStore.cpp
PStore.cpp(169) : error C2220: warning treated as error - no 'object' file generated
PStore.cpp(169) : warning C4091: '' : ignored on left of 'bool' when no variable is declared
PStore.cpp(169) : error C2143: syntax error : missing ';' before 'inline function header'
PStore.cpp(170) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
PStore.cpp(170) : error C2556: 'int PStore::getVersion(std::string &)' : overloaded function differs only by return type from 'bool PStore::getVersion(std::string &)'
    ../include\PStore.h(48) : see declaration of 'PStore::getVersion'
PStore.cpp(170) : error C2371: 'PStore::getVersion' : redefinition; different basic types
    ../include\PStore.h(48) : see declaration of 'PStore::getVersion'
Run Code Online (Sandbox Code Playgroud)

这是代码片段:

bool PStore::getVersion(std::string& version)
{
    AMPI_INFO("[API]");

    return getVersionNoLogging(version);
}
bool PStore::getVersionNoLogging(std::string& version)
{
    version = AMPI_PStore_VERSION " " __DATE__ " " __TIME__;

    return true;
}
Run Code Online (Sandbox Code Playgroud)

hou*_*oft 5

请发布您的代码,以便解释所有错误.

但其中一个错误显而易见:您不能拥有两个具有相同参数和相同名称的函数.

在你的情况下,你有int PStore::getVersion(std::string &)bool PStore::getVersion(std::string &),这是不合法的.

更改其中一个功能的名称,或更改其中一个功能的参数类型或数量.