C++ Get Started

Install a compiler and build your program.

✍️ 2 exercises in this lesson
  1. Install a compiler: g++ (MinGW-w64 / MSYS2 on Windows), clang++ on macOS, or Visual Studio (MSVC).
  2. Save your code as main.cpp.
  3. Compile with a modern standard: g++ -std=c++20 main.cpp -o main
  4. Run: ./main

Visual Studio, CLion and VS Code are popular C++ IDEs.

Key Takeaways: C++ Get Started

Mastering C++ Get Started helps you write clean and reliable C++ code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

C++ Get Started Code Example

C++
#include <iostream>

int main() {
    std::cout << "C++ standard: " << __cplusplus << "\n";
    return 0;
}
Output
C++ standard: 202002
Run this example on your own computer. The "Get Started" lesson shows how to set it up.

C++ Get Started Practice Exercises

Check what you learned in “C++ Get Started”.

/ 2 solved
Fill in the blank

Compile with the C++20 standard.

g++  main.cpp -o main
✓ Correct! Not quite. Try again.
Multiple choice

Which file extension is common for C++ source files?

✓ Correct! Not quite. Try again.
to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services