所以这可能是我最近看到的最奇怪的事情,我很好奇这是怎么发生的。编译器给了我一个错误,说 std::string 在用作返回类型时未定义,但在用作类方法中的参数时未定义!
#pragma once
#include <string>
#include <vector>
// forward declarations
class CLocalReference;
class CResultSetHandle;
class MyClass
{
public:
MyClass() {}
~MyClass {}
void Retrieve(const CLocalReference& id, CResultSetHandle& rsh, std::string& item); // this is fine
const std::string Retrieve(const CLocalReference& id, CResultSetHandle& rsh); // this fails with std::string is undefined?!?!
};
重新构建所有它仍然发生,我必须选择干净的解决方案,然后再次重新构建所有,以便宇宙重新调整。虽然目前已经解决,但我仍然想知道是什么原因造成的,因为我不知道为什么什么时候不应该发生冲突,尤其是当我总是为 STL 使用完全限定名称时。