我认为方法和Windows宏之间可能存在冲突。 我正在使用cygwin gcc,这就是我的冲突看起来像
File : MRepository.h
#pragma once
#ifdef GetMessage
#undef GetMessage
#endif //GetMessage
class MRepository
{
public:
std::wstring GetMessage(const std::wstring &key) const;
...
....
};
File : MRepository.cpp
bool MRepository::SomeMethod(boost::shared_ptr<foo> &nd)
{
std::wstring type = this->GetMessage(L"SomeData"); //Error Here : Method not recognized
....
....
return available;
}
这是我从方法
中得到的错误error: 'class MRepository' has no member named 'GetMessageA'|
请注意,我调用了GetMessage
,但是当我清楚地输入{{1}时,它认为该方法被称为GetMessageA
有关编译器认为我尝试引用GetMessageA
的原因的任何建议}?
答案 0 :(得分:1)
我发现的最佳解决方案是将您的方法重命名为不会与Windows宏发生冲突的内容。
您可能会在调用点的.cpp中找到GetMessage的宏是有效的。