读书人

编译gtest时gtest-spi.h的InterceptMo

发布时间: 2013-01-07 10:02:24 作者: rapoo

编译gtest时gtest-spi.h的InterceptMode报错
本帖最后由 kerosun 于 2012-09-08 23:52:04 编辑 在编译gtest时出错:
提示:
Invalid redefinition of 'InterceptMode'

各位帮忙看看是什么原因。

源代码如下:


class GTEST_API_ ScopedFakeTestPartResultReporter
: public TestPartResultReporterInterface {
public:
// The two possible mocking modes of this object.
enum InterceptMode {
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
INTERCEPT_ALL_THREADS // Intercepts all failures.
};

// The c'tor sets this object as the test part result reporter used
// by Google Test. The 'result' parameter specifies where to report the
// results. This reporter will only catch failures generated in the current
// thread. DEPRECATED
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);

// Same as above, but you can choose the interception scope of this object.
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, TestPartResultArray* result);

// The d'tor restores the previous test part result reporter.
virtual ~ScopedFakeTestPartResultReporter();

// Appends the TestPartResult object to the TestPartResultArray
// received in the constructor.
//
// This method is from the TestPartResultReporterInterface
// interface.
virtual void ReportTestPartResult(const TestPartResult& result);
private:
void Init();

const InterceptMode intercept_mode_;
TestPartResultReporterInterface* old_reporter_;
TestPartResultArray* const result_;

GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
};

[解决办法]
重定义,搜索下这个字符串的定义到底有几处就知道了。

读书人网 >C++

热点推荐