Ugenz Academy/Tutorial

Setup

4 min read674 words

Reading progress

Keep learning

C++ Setup Guide

This guide explains how to set up a C++ programming environment on your computer.

1. What is C++?

C++ is a general-purpose programming language used to develop software, games, operating systems, desktop applications, and many other types of programs.

To write and run C++ programs, you need:

  • A C++ compiler
  • A code editor or IDE
  • A terminal/command prompt

2. Install a C++ Compiler

A compiler converts C++ source code into machine code that the computer can execute.

Windows

You can install MinGW-w64 to get the GNU C++ compiler.

After installation, make sure the compiler's bin directory is added to the system PATH.

Check the installation using:

g++ --version

If the installation is successful, the terminal will display the installed GCC/G++ version.

Linux

On Ubuntu/Debian-based systems, install the compiler using:

sudo apt update sudo apt install g++

Then check:

g++ --version

macOS

Install Apple's command-line developer tools:

xcode-select --install

Then check the compiler:

clang++ --version

3. Install a Code Editor

You can write C++ programs using different editors and IDEs.

Popular choices include:

  • Visual Studio Code
  • Code::Blocks
  • Dev-C++
  • Visual Studio
  • CLion

For beginners, Visual Studio Code is a good choice because it supports C++ with extensions.

4. Set Up Visual Studio Code

If you use Visual Studio Code:

  1. Install Visual Studio Code.
  2. Open Visual Studio Code.
  3. Open the Extensions section.
  4. Search for C/C++.
  5. Install the Microsoft C/C++ extension.
  6. Make sure a C++ compiler such as g++ is installed.
  7. Create a folder for your C++ programs.

For example:

C++/ ├── hello.cpp ├── variables.cpp └── functions.cpp

5. Write Your First C++ Program

Create a file named:

hello.cpp

Add the following code:

#include <iostream> using namespace std; int main() { cout << "Hello, World!" << endl; return 0; }

6. Compile the Program

Open the terminal in the folder containing hello.cpp.

Use:

g++ hello.cpp -o hello

This command compiles the C++ program and creates an executable named hello.

7. Run the Program

Windows

hello

or:

.\hello.exe

Linux/macOS

./hello

Output:

Hello, World!

8. Compile Using a Specific C++ Standard

Modern C++ programs can use standards such as C++11, C++14, C++17, C++20, and C++23.

For example:

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

To use C++20:

g++ hello.cpp -std=c++20 -o hello

9. Common Setup Problems

Problem 1: g++ is not recognized

If Windows shows:

'g++' is not recognized as an internal or external command

the compiler may not be installed correctly or its bin folder may not be included in the system PATH.

Problem 2: Compilation Error

Check:

  • File extension is .cpp
  • C++ syntax is correct
  • Compiler is installed
  • Header files are correctly included

Problem 3: Program Does Not Run

Make sure compilation completed successfully and run the generated executable from the correct directory.

10. Recommended Folder Structure

A simple C++ learning project can be organized as:

cpp-programming/ │ ├── setup.md ├── introduction.md ├── variables.md ├── datatypes.md ├── inputandoutput.md ├── operators.md ├── controlflow.md ├── function.md ├── array.md ├── string.md ├── pointers.md ├── structure.md ├── union.md ├── enumeration.md ├── preprocessor.md └── filehandling.md

11. Quick Setup Checklist

Before starting C++ programming, make sure:

  • C++ compiler is installed
  • g++ --version works
  • Code editor is installed
  • C/C++ extension is installed if using VS Code
  • A C++ project folder is created
  • A .cpp file can be compiled
  • A C++ program can be executed

Conclusion

After completing this setup, you are ready to start learning C++ programming. You can begin with basic topics such as variables, data types, input/output, operators, control flow, functions, arrays, strings, pointers, structures, and file handling.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy