프로젝트

일반

사용자정보


Windows WSL 개발환경 구축

Windows

  1. VS Code 설치
    https://code.visualstudio.com/

  2. WSL Ubuntu 설치
    https://learn.microsoft.com/ko-kr/windows/wsl/install(한국어)
    https://learn.microsoft.com/en-us/windows/wsl/install(영어)

    C:> wsl --install
    
  3. VS Code WSL 연결

  4. VS Code 단축키 변경 (Ctrl + K + S , 바로가기키 Json 열기)

    // Ctrl+F5 릴리즈 빌드+실행
    // Ctrl+F6 릴리즈 실행
    // Ctrl+F7 릴리즈 빌드
    // Shift+Ctrl+F5 릴리즈 클린 빌드+실행
    // Shift+Ctrl+F6 릴리즈 클린
    // Shift+Ctrl+F7 릴리즈 클린 빌드
    // Alt+Ctrl+F5 디버그 빌드+실행
    // Alt+Ctrl+F6 디버그
    // Alt+Ctrl+F7 디버그 빌드
    // Alt+Shift+Ctrl+F5 디버그 클린 빌드+실행
    // Alt+Shift+Ctrl+F6 디버그 클린
    // Alt+Shift+Ctrl+F7 디버그 클린 빌드
    // 키 바인딩을 이 파일에 넣어서 기본값 재정의
    [
    {
        "key": "ctrl+F1",
        "command": "terminalCommandKeys.run",
        "args": {
            // "cmd": "cd '${fileDirname}' && '${file}'",
            "cmd": "'${file}'",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    // {
    //     "key": "f5",
    //     "command": "-workbench.action.debug.start",
    //     "when": "debuggersAvailable && !inDebugMode"
    // },
    // {
    //     "key": "f5",
    //     "command": "extension.multiCommand.execute",
    //     "args" : { "command" : "multiCommand.build_debug" },
    //     "when": "debuggersAvailable && !inDebugMode"
    // },
    {
        "key": "ctrl+f5",
        "command": "-workbench.action.debug.run"
    },
    {
        "key": "ctrl+shift+alt+f5",
        "command": "workbench.action.debug.run"
    },
    {
        "key": "ctrl+F5",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b build run",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+shift+F5",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b clean build run",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+F6",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b run",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+shift+F6",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b clean",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+F7",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b build",
                // "cd '${workspaceRoot}' && gc.cpp \"${file}\"",
                // "cd '${workspaceRoot}' && gcc -c -o /tmp/a.o '${file}'",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+shift+F7",
        "command": "terminalCommandKeys.run",
        "args": {
            "cmd": "cd '${workspaceRoot}' && root bash ./.script/_b clean build",
                // "cd '${workspaceRoot}' && gc.cpp \"${file}\"",
                // "cd '${workspaceRoot}' && gcc -c -o /tmp/a.o '${file}'",
            "newTerminal": false,
            "saveAllFiles": true,
            "showTerminal": true,
            "focus": false
        }
    },
    {
        "key": "ctrl+F8",
        "command": "workbench.action.terminal.kill"
    },
    {
        "key": "ctrl+F9",
        "command": "workbench.action.terminal.scrollToTop"
    },
    {
        "key": "ctrl+F10",
        "command": "workbench.action.terminal.scrollToBottom"
    },
    {
        "key": "ctrl+f11",
        "command": "editor.action.formatDocument",
        "when": "editorHasDocumentFormattingProvider && editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+f11",
        "command": "editor.action.formatDocument.none",
        "when": "editorTextFocus && !editorHasDocumentFormattingProvider && !editorHasDocumentFormattingProvider && !editorReadonly"
    },
    // ctrl+shift+` : 새 터미널 생성 키 제거
    {
        "key": "ctrl+shift+oem_3",
        "command": "-workbench.action.terminal.new"
    },
    {
        // ctrl+shift+` : 쉘 런쳐 추가
        "key": "ctrl+shift+oem_3",
        "command": "shellLauncher.launch"
    },
    
    {
        "key": "f2",
        "command": "-editor.action.rename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "f2",
        "command": "-debug.renameWatchExpression",
        "when": "watchExpressionsFocused"
    },
    {
        "key": "f2",
        "command": "-debug.setVariable",
        "when": "variablesFocused"
    },
    {
        "key": "f2",
        "command": "-remote.tunnel.label",
        "when": "tunnelViewFocus && tunnelType == 'Forwarded'"
    },
    {
        "key": "f2",
        "command": "editor.action.revealDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "f2",
        "command": "renameFile",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "f2",
        "command": "-renameFile",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "f2",
        "command": "editor.gotoNextSymbolFromResult",
        "when": "hasSymbols"
    },
    {
        "key": "f2",
        "command": "goToNextReference",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "ctrl+f2",
        "command": "-editor.action.changeAll",
        "when": "editorTextFocus && editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+f12",
        "command": "editor.action.changeAll",
        "when": "editorTextFocus && editorTextFocus && !editorReadonly"
    },
    
    {
        "key": "ctrl+f12",
        "command": "editor.action.onTypeRename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+f2",
        "command": "-editor.action.onTypeRename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "f12",
        "command": "debug.renameWatchExpression",
        "when": "watchExpressionsFocused"
    },
    {
        "key": "f12",
        "command": "editor.action.rename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "f12",
        "command": "debug.setVariable",
        "when": "variablesFocused"
    },
    
    {
        "key": "f12",
        "command": "remote.tunnel.label",
        "when": "tunnelViewFocus && tunnelType == 'Forwarded'"
    },
    {
        "key": "f12",
        "command": "-editor.gotoNextSymbolFromResult",
        "when": "hasSymbols"
    },
    {
        "key": "ctrl+k f12",
        "command": "togglePeekWidgetFocus",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "ctrl+k f2",
        "command": "-togglePeekWidgetFocus",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "ctrl+f2",
        "command": "editor.action.goToImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+f12",
        "command": "-editor.action.goToImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "alt+f2",
        "command": "editor.action.peekDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "alt+f12",
        "command": "-editor.action.peekDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "f12",
        "command": "-editor.action.revealDefinition",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "shift+f2",
        "command": "editor.action.goToReferences",
        "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "shift+f12",
        "command": "-editor.action.goToReferences",
        "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+k f2",
        "command": "editor.action.revealDefinitionAside",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+k f12",
        "command": "-editor.action.revealDefinitionAside",
        "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+shift+f2",
        "command": "editor.action.peekImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "ctrl+shift+f12",
        "command": "-editor.action.peekImplementation",
        "when": "editorHasImplementationProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
    },
    {
        "key": "shift+alt+f2",
        "command": "references-view.find",
        "when": "editorHasReferenceProvider"
    },
    {
        "key": "shift+alt+f12",
        "command": "-references-view.find",
        "when": "editorHasReferenceProvider"
    },
    
    {
        "key": "f12",
        "command": "-goToNextReference",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "shift+f2",
        "command": "goToPreviousReference",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "shift+f12",
        "command": "-goToPreviousReference",
        "when": "inReferenceSearchEditor || referenceSearchVisible"
    },
    {
        "key": "ctrl+shift+alt+f11",
        "command": "psi-header.insertFileHeader"
    },
    {
        "key": "ctrl+pausebreak",
        "command": "markdown-preview-enhanced.openPreviewToTheSide",
        "when": "editorLangId == 'markdown'"
    },
    {
        "key": "ctrl+o",
        "command": "-workbench.action.files.openFile"
    },
    {
        "key": "ctrl+o",
        "command": "workbench.action.quickOpen",
        "args" : "option"
    }
    ]
    
  5. VS Code 확장 설치
    Korean Language Pack for Visual Studio Code(Microsoft)
    WSL(Microsoft)
    C/C++(Microsoft)
    C/C++ Extention Pack(Microsoft)
    C/C++ Themas(Microsoft)
    Git Graph(mhutchie)
    GitLens — Git supercharged(GitKraken)
    terminal-command-keys(Pete Kinnecom) : 개발 단축키 Shift,Ctrl,Alt + F5,F6,F7 에 사용.
    CMake(twxs)
    CMake Tools(microsoft)

WSL - ubuntu.

  1. Alias 설정
    alias root=''
    alias root='sudo'
    VS Code 실행 단축키의 root 명령어..
    sudo 계정 빌드가 필요하면 'sudo' 로 설정하고 그렇지 않으면 ''으로 값을 설정한다.

  2. 리눅스 개발 유틸 및 라이브러리 설치

    $ sudo apt update
    $ sudo apt install git build-essential cmake ninja-build libboost-all-dev
    
    • gcc/g++ 은 build-essential 설치에 포함됨.
    • libboost-all-dev 보통 많이 사용하는 C++ 라이브러리.