2015-01-07 4 views
0
#include <iostream> 
using namespace std; 


void fun(int i) 
{ 
    cout<<"Called with int "<<i; 
} 

void main() 
{ 
    using df = decltype(&fun); 
} 

나는 형 앨리어싱을 지원하지 않습니다, 프로젝트 디렉토리에 따라,왜이 간단한 코드에서 구문 오류가 발생합니까?

Error 1 error C2143: syntax error : missing ';' before '=' c:\users\kpranit\documents\visual studio 2012\projects\sample\sample\sample.cpp 12 

Error 2 error C2873: 'df' : symbol cannot be used in a using-declaration c:\users\kpranit\documents\visual studio 2012\projects\sample\sample\sample.cpp 12 
+0

나를 위해 작동합니다. – BWG

+0

해당 버전의 컴파일러가 너무 오래되었습니다. 최신 버전을 사용해 보시겠습니까? –

답변

3

비주얼 스튜디오 2012, 사용중인 하나, Visual Studio에서 다음과 같은 구문 오류를 얻고있다.

MSDN documentation의 경우 C++ 11 기능이며, 심지어 VS2013의 경우에도 표시되지 않습니다. 그 부분의 문서 오류 일 수 있습니다. Microsoft site for C++11 compatibility (별칭 템플릿 찾기) 목록 그것은 VS2013 하에서 이용 가능하다.

따라서이 기능을 사용하려면 나중에 컴파일러로 업그레이드해야 할 것입니다.

관련 문제