2017-09-28 1 views
0

업데이트 : catch 1.9.7을 사용하면이 문제가 해결됩니다.Visual Studio 2008에서 catch를 컴파일 할 때 오류가 발생했습니다.

나는 그냥 잡기를 사용하는 것으로 시작하고 있으며, 컴파일하는 간단한 테스트 프로젝트조차도 얻을 수 없었다. Visual Studio 2008을 사용하고 catch.hpp v1.10.0 (단일 파일 버전)을 사용하고 있습니다.

나는 catch 튜토리얼에 따라 간단한 테스트 프로젝트를 만들었습니다. MAIN.CPP이 유일한 파일과 코드는 다음과 같이 구성

c:\utilities\catch\catchtest\catchtest\catch.hpp(1333) : warning C4181: qualifier applied to reference type; ignored 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1838) : see reference to class template instantiation 'Catch::Internal::Evaluator<T1,T2,Op>' being compiled 
with 
[ 
    T1=const int &, 
    T2=const int &, 
    Op=IsEqualTo 
] 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1836) : while compiling class template member function 'void Catch::BinaryExpression<LhsT,Op,RhsT>::endExpression(void) const' 
with 
[ 
    LhsT=const int &, 
    Op=IsEqualTo, 
    RhsT=const int & 
] 
c:\utilities\catch\catchtest\catchtest\main.cpp(8) : see reference to class template instantiation 'Catch::BinaryExpression<LhsT,Op,RhsT>' being compiled 
with 
[ 
    LhsT=const int &, 
    Op=IsEqualTo, 
    RhsT=const int & 
] 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1333) : error C2529: 'lhs' : reference to reference is illegal 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1333) : warning C4181: qualifier applied to reference type; ignored 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1333) : error C2529: 'rhs' : reference to reference is illegal 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1838) : error C2664: 'Catch::Internal::Evaluator<T1,T2,Op>::evaluate' : cannot convert parameter 1 from 'const int' to 'const int &(&)' 
with 
[ 
    T1=const int &, 
    T2=const int &, 
    Op=IsEqualTo 
] 
c:\utilities\catch\catchtest\catchtest\catch.hpp(1839) : error C2228: left of '.endExpression' must have class/struct/union 

어떤 도움이 많이 주시면 감사하겠습니다 :

#define CATCH_CONFIG_MAIN 
#include "catch.hpp" 

TEST_CASE("test case 1") 
{ 
    REQUIRE(1==2); 
} 

내가 컴파일 할 때 나는 다음과 같은 오류를 얻을. 나는 캐치 문서 또는 온라인에서 무엇이든을 찾을 수없고 그것을 시작하기 위하여 열망한다.

답변

0

최신 Catch 마스터는 최신 C++ 컴파일러 용이며 Visual Studio 2008 컴파일러는 꽤 오래되었습니다. 당신은 몇 가지 기능을 다운 그레이드하는 데 사용할 수있는 몇 가지 스위치가 있습니다 :

https://github.com/philsquared/Catch/blob/master/docs/configuration.md

는 # include'ing 잡기 전에 정의 'CATCH_CONFIG_NO_CPP11'로보십시오.

+0

행운은 있지만 여전히 같은 오류가 있습니다. – JMayer

0

나중에 참조 할 수 있도록 : MSVC 9에 대한 지원이 this commit에 의해 중단되었고 b6e7c9bd7a160c07c5de894292022687895c17a3 (그 위에 수행됨)으로 되 돌린 다음이 문제를 해결하기에 충분합니다.

관련 문제