c++ 컴파일시 extension 에러나는 경우
컴파일 에러
컴파일시 확장팩들을 잘 인식 못 하는 경우가 있었습니다. 이 경우 아래와 같은 에러들이 발생합니다.
1
2
warning: 'auto' type specifier is a C++12 extension
'auto' return without trailing return type; deduced return types are a C++14 extension
해결 방법
- g++ 명령시 c++ 버전을 옵션으로 전달
1
g++ -std=c++11 <filename>
- .bash_profie에 alias를 추가해서 g++ 사용시마다 옵션을 사용하도록
1 2
echo 'alias g++="g++ -std=c++14"' >> ~/.bash_profile source ~/.bash_profile
This post is licensed under CC BY 4.0 by the author.