Visual Studio 2010使用std :: string编译错误?

时间:2011-01-10 16:48:05

标签: c++ visual-studio-2010 stl stdstring

所以这可能是我最近看到的最奇怪的事情,并且好奇这是怎么发生的。编译器给我一个错误,说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的完全限定名称时。

1 个答案:

答案 0 :(得分:0)

这可能是编译器错误。我在VS2010中见过其他几个。