💾
EC
  • Introduction
  • EC Course
    • Syllabus
    • Preparation for EC
    • Tutorial
      • Tutorial: arduino-stm32
        • Tutorial: arduino-stm32 Installation
        • Tutorial: arduino-stm32 Part1
        • Tutorial: arduino-stm32 Part2
      • Tutorial: MDK uVision
        • Tutorial: Installing MDK uVision
        • Tutorial: Create a Project with uVision
        • Tutorial: Adding library header in uVision
        • Tutorial: Re-using Project Configuration
        • Debugging in uVision
      • Tutorial: PlatformIO in CLion
      • Tutorial: PlatformIO in VSCode
      • Tutorial: Repository Management
      • Tutorial: Managing library header files
      • Tutorial: PinName Configuration
      • Tutorial: Bitwise Macro
      • Tutorial: Custom initialization
      • Tutorial: Documentation
      • Tutorial: Creating Application API
      • Tutorial: 7-Segment Display
      • Tutorial: DC motor driver connection
      • Tutorial: USART with TeraTerm
      • Tutorial: Finite State Machine programming
      • Tutorial: Bluetooth
      • Tutorial: Zigbee with Nucleo board
    • LAB
      • LAB Report Template
      • LAB: Smart mini-fan with STM32-duino
      • LAB: Portable Fan with mbed
      • LAB: GPIO Digital InOut
      • LAB: GPIO Digital InOut 7-segment
      • LAB: EXTI & SysTick
      • LAB: Timer & PWM
      • LAB: Stepper Motor
      • LAB: Input Capture - Ultrasonic
      • LAB: USART - LED, Bluetooth
      • LAB: ADC - IR reflective sensor
      • LAB: Line Tracing RC Car
    • Sample code
      • Code Templates
    • Hardware
      • Nucleo-F411RE
      • LAB Hardware
        • Electronic Chips
        • HUINS Embedded Kit
    • Projects
      • Line Tracing Car Project
      • Design Project
        • Past Projects
      • Project Grading Criteria
    • Study Resource for MCU
      • Hexa-Decimal Table
      • Bitwise Op for Register
      • System Clock
      • Timer
      • USART
      • ADC
  • STM32 M4 Programming
    • Documentation
      • C++ API Docs
    • Firmware Library
      • PinName Configuration
      • GPIO Digital
      • RCC
      • EXTI_SysTick
      • TIMER
      • USART
    • Troubleshooting
    • mbed for STM32
      • Tutorial: mbed-Part 1
      • Tutorial: mbed - Part 2
      • Tutorial: mbed - Part 3
      • Using mbed API on uVision
    • mbed OS
  • Other Programming
    • Arduino
    • Socket Programming
      • Window Socket Programming
      • Arduino WiFi
    • Cube-MX
    • Github
    • Markdown
      • Example: API documentation
    • MATLAB
  • C Programming
    • C-Programming Lessons
      • Installing Visual Studio Community
        • Visual Studio Community 2022
      • Installing VS Code(Mac/Linux)
      • Creating Header Lib
      • Pointer
      • Array
      • 2D Array
      • Structure
      • Dynamic Alloc
      • Bitwise Operation
  • Numerical Programming
    • Syllabus
    • Preparation for NP
    • Math Review
    • Tutorial
      • TA Session Video
      • Tutorial: NP Library Header Files
      • Tutorial - Sine Taylor
      • Tutorial: Passing a Function, Function callback
      • Tutorial: Nonlinear solver
      • Tutorial: Differentiation
      • Tutorial: Integration
      • Tutorial: Matrix Structure
      • Tutorial: Eigenvalue problem
      • Tutorial: ODE-IVP
      • Tutorial: Curve Fitting
      • Tutorial: Create Github Repos of NP lib
      • Tutorial: Version Control in Github
      • Tutorial: Documentation with Markdown
      • Exercise: Version Control and Documentation
    • Example: MATLAB
    • Example: NP Library
    • Assignment
      • Assignment Factorial and Power
      • Assignment: Version Control and Documentation
    • Problem Bank
Powered by GitBook
On this page
  • Installing VS Code(Mac/Linux)
  • Visual Studio Code
  • I. 특징
  • II. 설치
  • III. 프로젝트 설정
  • 부록1: CMake 설치
  • Windows
  • Linux
  • Mac
  • 부록2: Visual Studio 빌드 도구 설치

Was this helpful?

  1. C Programming
  2. C-Programming Lessons

Installing VS Code(Mac/Linux)

PreviousVisual Studio Community 2022NextCreating Header Lib

Last updated 8 months ago

Was this helpful?

Installing VS Code(Mac/Linux)

C/C++ Programming environment for Mac users

개요


Visual Studio Code

I. 특징

Visual Studio의 텍스트 편집기 기반으로 Microsoft 사에서 만든 코드 편집기이다. 엄밀하게 말하면 IDE가 아니다. 하지만 Visual Studio Code(이하 VScode)에서 제공하는 다양한 확장 옵션으로 IDE와 비슷하게 사용할 수 있다.

장점

  1. 가볍게 실행되는 프로그램 텍스트 편집기 기반이기 때문에 엄청 가볍다. 사실상 기능 많은 메모장에 가깝다.

  2. 다양한 언어 지원 C, C++, Python, JAVA 등 다양한 언어를 하나의 툴에서 개발할 수 있다.

  3. 다양한 확장 옵션 오픈 소스이기 때문에 다양한 확장을 통해서 IDE와 비슷한 기능을 확보할 수 있다.

  4. 크로스 컴파일 지원 Windows, Linux, Mac을 모두 지원한다. 다양한 OS에서 개발할 경우 아래의 CLion과 함께 좋은 선택지다.

  5. 유저 친화적 GUI GUI가 단순하기 때문에 복잡하지 않다.

단점

  1. 프로젝트 단위 빌드 힘듬 프로젝트 단위로 개발하기 위해서는 CMake와 같은 빌드 도구의 힘을 빌려야 한다. 때문에 CMake 작성법을 추가로 학습해야 하며, 빌드 에러가 발생할 수 있다.

  2. 느린 속도(확장을 많이 깔았을 때) 확장을 통해서 IDE와 비슷한 기능을 확보한 경우 IDE만큼 속도가 느려지는 경우가 많다. 특히 언어 확장을 다수 설치한 경우 두드러진다. 때문에 본인이 필요한 기능만 설치하는 것이 좋다.

  3. 힘든 프로젝트 초기 설정 CMake 초기 설정시에 컴파일러, 빌드 툴 등을 수동으로 지정해야 한다.

II. 설치

  1. 다운로드 받은 설치 파일을 실행한다.

  2. C/C++ 개발에 필요한 확장을 설치한다.

III. 프로젝트 설정

  1. 임의의 위치에 폴더를 하나 만든다. (본 문서에서는 Tutorial)

  2. VScode에서 해당 폴더를 열고, F1키를 누른다. 이후 CMake: Quick Start를 입력한다.

  3. 프로젝트 이름을 입력한다. 프로젝트 이름은 생성한 폴더 이름과 동일하게 설정한다.

  4. 언어는 C를 선택한다.

  5. 실행파일(Excutable)을 선택한다.

  6. 빌드 설정을 추가한다.

  7. 컴파일러에서 만들기를 선택한다.

  8. 컴파일러를 선택한다. 윈도우는 Visual Studio, Mac은 Clang을 선택한다.

  9. CMakeLists.txt에 아래 내용을 복사한다. <PROJECT>부분은 본인의 프로젝트 이름으로 수정한다.

    cmake_minimum_required(VERSION 3.25)
    project(<PROJECT> LANGUAGES C)
    
    set(CMAKE_C_STANDARD 17)
    
    file(GLOB_RECURSE SOURCE
         ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c
         )
    
    add_executable(${PROJECT_NAME} main.c ${SOURCE})
    target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
  10. main.c를 아래와 같이 수정후 실행해 본다.

    #include <stdio.h>
    
    int main()
    {
        printf("Hello World!");
    
        return 0;
    }

부록1: CMake 설치

Windows

  1. 설치 프로그램에서 아래 순서와 같이 설치한다.

Linux

  1. apt를 업데이트 한다

    sudo apt update
  2. CMake를 다운로드 받는다

    sudo apt install cmake

Mac

  1. Homebrew를 설치한다

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Homebrew가 설치되었는지 확인한다.

    brew -v
  3. command not found: brew 에러가 발생하는 경우 아래 명령을 터미널에 입력한다.

    echo 'export PATH=/opt/homebrew/bin:$PATH'

부록2: Visual Studio 빌드 도구 설치

  1. 인스톨러에서 아래와 같이 설정 후 설치한다.

에 접속하여 설치 파일을 다운로드 받는다.

CMake를 설치한다.( 참고)

빌드 도구를 설치한다. (Windows만 해당, 참고)

에 접속하여 최신버전 CMake를 설치한다.

에 접속하여 인스톨러를 다운로드 받는다.

설치 사이트
설치 사이트
Visual Studio Code
부록1: CMake 설치
부록2: Visual Sutdio 빌드 도구 설치
부록1: CMake 설치
부록: Visual Sutdio 빌드 도구 설치
CMake 설치 사이트