开发者

Visual Studio 2010 compile error with std::string?

开发者 https://www.devze.com 2023-02-03 23:40 出处:网络
So this is possibly the strangest thing I\'ve seen recently and was curious how this could happen.The compiler gave me an error saying that std::string is undefined when used as a return type but not

So this is possibly the strangest thing I've seen recently and was curious how this could happen. The compiler gave me an error saying that std::string is undefined when used as a return type but not when used as a parameter in methods of a class!

#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?!?!
};

Doing a Rebuild All it still happened I had to choose clean solution and then Rebuild All again after for the universe to realign. While it's resolved for the moment I'd still like to know what could have caused this because I'm at开发者_JAVA百科 a loss as to why when there should be no conflicts especially when I always use fully qualified names for STL.


This is probably a compiler bug. I have seen several others in VS2010.

0

精彩评论

暂无评论...
验证码 换一张
取 消