AICollection Help

Chapter 1 - Installing and Setting Up Tools

This guide will walk you through the installation and setup of all the tools you'll need to follow the Basic Programming course. By the end of this guide, you'll have a fully functioning programming environment, ready for Python, PHP, C++, Zig, and Go development on Linux, Windows, and macOS.

Tools Overview

  1. Code Editor: Visual Studio Code (VS Code) is recommended for this course.

  2. Compilers/Interpreters:

    • Python: Python interpreter (latest version)

    • PHP: PHP runtime

    • C++: GCC or Clang compiler

    • Zig: Zig programming language toolchain

    • Go: Go programming language toolchain

  3. Version Control: Git for source code management.

  4. Terminal Emulator: Optional for Windows users—install Windows Terminal or use the built-in Command Prompt/PowerShell.

  5. Build Tools: Additional build tools like Make or CMake for C++ projects.

Installing Visual Studio Code

Linux

  1. Download the VS Code package for your Linux distribution:

    wget -qO- https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64 -O vscode.deb sudo dpkg -i vscode.deb sudo apt-get install -f # Fix dependencies
  2. Start VS Code:

    code

Windows

  1. Download VS Code from Visual Studio Code’s official website.

  2. Run the installer and follow the setup wizard.

  3. Ensure the "Add to PATH" option is checked during installation.

macOS

  1. Download the VS Code .dmg file from Visual Studio Code’s website.

  2. Drag the VS Code icon into the Applications folder.

  3. Open VS Code from Launchpad or Finder.

Installing Compilers and Runtimes

Python

  • Linux:

    sudo apt update sudo apt install python3 python3-pip
  • Windows:

    1. Download Python from python.org.

    2. Run the installer and ensure "Add Python to PATH" is selected.

  • macOS:

    brew install python

PHP

  • Linux:

    sudo apt update sudo apt install php
  • Windows:

    1. Download PHP from php.net.

    2. Add PHP to the system PATH.

  • macOS:

    brew install php

C++ Compiler (GCC/Clang)

  • Linux:

    sudo apt update sudo apt install build-essential
  • Windows:

    1. Install MSYS2.

    2. Open MSYS2 and run:

      pacman -S mingw-w64-x86_64-gcc
  • macOS:

    xcode-select --install

Zig

  • Linux:

    wget https://ziglang.org/download/index.html -O zig.tar.xz tar -xf zig.tar.xz sudo mv zig-* /opt/zig sudo ln -s /opt/zig/zig /usr/local/bin/zig
  • Windows:

    1. Download Zig from ziglang.org.

    2. Extract the zip file and add Zig to your system PATH.

  • macOS:

    brew install zig

Go

  • Linux:

    wget https://golang.org/dl/go1.20.linux-amd64.tar.gz -O go.tar.gz sudo tar -C /usr/local -xzf go.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile source ~/.profile
  • Windows:

    1. Download Go from golang.org.

    2. Run the installer and follow the setup wizard.

    3. Restart your terminal to ensure Go is added to the PATH.

  • macOS:

    brew install go

Installing Git

  • Linux:

    sudo apt update sudo apt install git
  • Windows:

    1. Download Git from git-scm.com.

    2. Follow the setup wizard, choosing default options unless otherwise specified.

  • macOS:

    brew install git

Optional: Installing Build Tools (Make/CMake)

Make

  • Linux:

    sudo apt install make
  • Windows:

    1. Install GNU Make.

    2. Add Make to the PATH.

  • macOS:

    brew install make

CMake

  • Linux:

    sudo apt install cmake
  • Windows:

    1. Download CMake from cmake.org.

    2. Run the installer and select "Add CMake to system PATH."

  • macOS:

    brew install cmake

Verifying Your Setup

Run the following commands to verify the installation of each tool:

  • Python:

    python3 --version
  • PHP:

    php --version
  • GCC (C++):

    gcc --version
  • Zig:

    zig version
  • Go:

    go version
  • Git:

    git --version
  • Make (if installed):

    make --version
  • CMake (if installed):

    cmake --version

Setting Up Your Development Environment

  1. Install Extensions in VS Code:

    • Python

    • PHP Intelephense

    • C++

    • Zig Language Support

    • Go

    • GitLens (for Git integration)

  2. Configure Git:

    git config --global user.name "Your Name" git config --global user.email "youremail@example.com"
  3. Test a "Hello, World!" Program in Each Language:

  • Python:

    print("Hello, World!")
  • PHP:

    <?php echo "Hello, World!"; ?>
  • C++:

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

    const std = @import("std"); pub fn main() void { std.debug.print("Hello, World!\n", .{}); }
  • Go:

    package main import "fmt" func main() { fmt.Println("Hello, World!") }
  1. Run each program using the respective compiler or interpreter.

Now that you have all the tools installed and configured, you're ready to dive into the Basic Programming course!

Last modified: 26 January 2025