Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Lesson 2: Setting Up Development Environ | C++ Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. C++ Course

Lesson 2 of 45

·C++

Lesson 2: Setting Up Development Environment

10 min

Course progress4%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • Choosing a compiler (G++, clang, MSVC)
  • Installing Visual Studio Code / CLion / Visual Studio
  • Configuring build tasks and debugging
  • First project compilation

Setting Up Development Environment

Before you can write C++ code you need a compiler, a linker, and an editor or IDE. The most common toolchains are:

  • GCC (Linux & macOS) – sudo apt-get install build-essential or brew install gcc.
  • Clang – bundled with Xcode on macOS and also available via brew install llvm.
  • MSVC – comes with Visual Studio 2022 (Community edition works fine).
  • MinGW‑w64 – provides GCC for Windows.

Once a compiler is installed, you need an editor. VS Code is lightweight and works cross‑platform. Below is a minimal tasks.json that lets you build and run a single‑file program with g++:

{
    \"version\": \"2.0.0\",
    \"tasks\": [
        {
            \"label\": \"build and run\",
            \"type\": \"shell\",
            \"command\": \"g++\",
            \"args\": [
                \"-std=c++20\",
                \"${file}\",
                \"-o\",
                \"${fileDirname}/${fileBasenameNoExtension}\"
            ],
            \"group\": {
                \"kind\": \"build\",
                \"isDefault\": true
            },
            \"problemMatcher\": \"$gcc\",
            \"detail\": \"Compiled with g++\"
        }
    ]
}

If you prefer a build system, CMake is the de‑facto standard. A tiny CMakeLists.txt looks like:

cmake_minimum_required(VERSION 3.15)
project(HelloCxx LANGUAGES CXX)
add_executable(hello main.cpp)
set_target_properties(hello PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED YES)

Tip: Install the C/C++ extension from Microsoft in VS Code. It provides IntelliSense, debugging, and linting out of the box.


<Alert type="info">If you are on Windows and prefer a full‑featured IDE, Visual Studio Community offers a one‑click install for the MSVC toolchain and a powerful debugger.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from C++ CourseBrowse activities
Previous lessonLesson 1: Introduction to C++Continue to lesson 3Lesson 3: Hello World and Basic SyntaxBack to C++ Course curriculum