error: non-aggregate type 'vector<int>' cannot be initialized with an initializer list

JunSeok·2022년 12월 30일
0

에러 해결

목록 보기
7/14

vscode editor에서 vector 초기화 과정 중 다음과 같은 에러가 발생했다.

g++ complier 환경을 들어가서 c++11을 사용하게 해야 한다.

해결방법

setting -> code run configuration -> code-runner: Executor map -> setting.json에서 편집 클릭

그 곳에서 code-runner.executorMap 아래 cpp 항목을 찾아 다음과 같이 바꿔준다.

// 기존 설정
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

// 바꾼 설정
"cpp": "cd $dir && g++ -std=c++11 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

출처
https://stackoverflow.com/questions/53995830/compiling-c11-in-visual-studio-code

profile
최선을 다한다는 것은 할 수 있는 한 가장 핵심을 향한다는 것

0개의 댓글