w1coding.comAll tutorials

C++ Environment Setup

C++ lessons
  1. Environment Setup
  2. Introduction To C
  3. Installing A C Compiler
  4. Your First C Program
  5. C Syntax Basics
  6. Data Types And Variables
  7. Operators In C
  8. Control Structures
  9. Loops In C
  10. Functions In C
  11. Arrays And Strings
  12. Pointers In C
  13. References In C
  14. Structures And Unions
  15. Object Oriented Programming Basics
  16. Classes And Objects
  17. Constructors And Destructors
  18. Inheritance In C
  19. Polymorphism
  20. Encapsulation And Abstraction
  21. Operator Overloading
  22. Function Overloading
  23. Templates In C
  24. Exception Handling
  25. File Handling In C
  26. Stl Vectors And Lists
  27. Stl Maps And Sets
  28. Smart Pointers In C
  29. Lambda Functions In C
  30. Multithreading Basics
  31. Best Practices In C

C++ needs a C++ compiler as well as an editor. Use g++ rather than gcc for the example so the C++ standard library is linked correctly.

What you need

  • A C++ compiler such as g++
  • A code editor; the VS Code C/C++ extension is optional
  • A terminal

Set up your environment

  1. Install VS Code if desired, then install a compiler separately. The C/C++ editor extension does not supply a compiler.
  2. On Windows follow the official VS Code MinGW/MSYS2 guide. Install the UCRT64 toolchain and add its bin folder to PATH as documented. On Linux use your distribution compiler packages; on macOS install the command-line developer tools.
  3. Reopen the terminal and verify g++ --version. Create a project folder and save the source file with the .cpp extension.
  4. Compile from the folder containing the source file, then run the executable. The commands below show a Windows terminal. On Linux/macOS choose an output name without .exe and run it with ./hello.

Your first check

Save as hello.cpp

#include <iostream>
int main() {
    std::cout << "Hello from w1coding.com\n";
    return 0;
}

Run or verify

g++ -std=c++17 hello.cpp -o hello.exe
.\hello.exe

Expected result: The terminal prints Hello from w1coding.com.

Common setup problems

  • An editor extension provides editing support; install the compiler toolchain separately.
  • On Linux/macOS compile to hello and run ./hello. Windows examples use .\hello.exe.

Official documentation

Guide reviewed 17 November 2026. Check the linked vendor documentation for current supported versions and operating systems.