Introduction to C++ Programming

Jul 8, 2024

C++ Programming - Lecture Notes

Introduction to C++

  • Fast language: Used in advanced graphics apps (Adobe, video editing) and video games.
  • Middle-level language: Falls between high-level languages (Python, Java) and low-level hardware instructions.
  • Learning curve: Worthwhile to master for performance benefits.

Tools Needed

  1. Text editor/IDE: VS Code, Code Blocks, etc.
  2. Compiler: GCC for Windows/Linux, Clang for macOS.

Setting Up the Environment

Installing VS Code

  1. Download from code.visualstudio.com.
  2. Install, create desktop icon if you prefer.
  3. Launch and install extensions: C/C++ and Code Runner.

Setting Up Compiler

Linux

  • Open terminal: gcc -v to check installation.
  • If not installed: sudo apt-get install build-essential.

macOS

  • Open terminal: clang -v to check.
  • If not installed: xcode-select --install.

Windows

  1. Install MinGW-w64.
  2. Open MSYS2, update with pacman -Syu.
  3. Install development tools: pacman -S --needed base-devel mingw-w64-x86_64-toolchain.
  4. Add bin folder to Windows PATH environment.
  5. Verify with g++ --version in Command Prompt.

Writing Your First Program