프로그래밍/에러가 났을때

[vscode] c++ 컴파일러 실행시키는법(MinGW64,setting json)

개발자 덕구🐾 2022. 1. 9. 00:12
728x90

파일 -> 기본설정 -> 설정

 

 

1. 검색 : code runner terminal  

-> whether to run code in~~~ 이거 체크하기 

 

 

 

 

2. 검색 : executor map 

 

settings.json 들어가면

마지막에 code-runner.exectorMap을 검색하면 자동완성을 눌러 완성해준다. 

 

 

 

완성하면 code-runner.exectorMap에 빨간 밑줄이 그어질 수 도 있다. 

그러면 앞에 콤마(,)를 찍으면 된다. 

 

 "cpp": "cd $dir && g++ -O2 -std=c++17 -static $fileName -o run.exe && run.exe",
->

-> cpp만 이렇게 변경해주고

 

 "code-runner.runInTerminal": true,
    "terminal.integrated.profiles.windows": {
        "GitBash": {
            "path":["D:\\Git\\bin\\bash.exe"],
            "icon":"terminal-bash"
        },
 
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
 
 
    },
    "terminal.integrated.defaultProfile.windows": "Command Prompt"

그 밑에 이렇게 복붙해준다. 

 

 

 

이렇게!

 


 

그 후 

 

3. g++ 컴파일러 다운받는 곳

 

https://sourceforge.net/projects/mingw/files/latest/download

 

4. 과정 설명해 놓은 곳 

 

https://woogyun.tistory.com/704

 

컴파일러 개발을 위한 MinGW 설치(gcc, flex, bison)

MinGW는 Windows에서 GCC를 사용할 수 있도록 하는 프로그램이다. 가상기계나 Cygwin보다 가벼우면서도 필요한 프로그램을 포함하고 있기 때문에 저사양의 컴퓨터에서 GCC만 사용하고 싶을 때 설치하

woogyun.tistory.com

 

 

 

 

다 따라서 하면

 

이 버튼 또는 ctrl + shift + n 으로 실행이 될것이다.

 

 

이제 드디어 vscode에서 c++을 컴파일 할 수 있다!!!

 

 

 

 

반응형