Skip to content

Karl-maker/k98-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Project Setup Guide

This guide explains how to set up, build, and run a basic C++ project on macOS, Windows, and Linux.


Prerequisites

Ensure you have a C++ compiler installed:

  • macOS: clang (via Xcode Command Line Tools)
  • Linux: g++ or clang++
  • Windows: MinGW (GCC) or Microsoft Visual Studio (MSVC)

1. Install a C++ Compiler

macOS

Install Xcode Command Line Tools:

xcode-select --install

Verify installation:

clang++ --version

Linux (Ubuntu/Debian)

Update packages and install build tools:

sudo apt update
sudo apt install build-essential

Verify installation:

g++ --version

Windows

Option 1: MinGW (GCC)

  1. Download and install MinGW
  2. Add bin directory to your system PATH
  3. Verify installation:
g++ --version

Option 2: Visual Studio (MSVC)

  1. Install Visual Studio
  2. Select Desktop development with C++ workload
  3. Use the Developer Command Prompt to compile code

2. Project Structure

A simple C++ project may look like this:

project-root/
│
├── src/
│   └── main.cpp
├── include/
├── build/        (optional)
└── README.md

3. Example C++ Program

Create a file at src/main.cpp:

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

4. Build the Project

Navigate to the project root:

cd /path/to/project-root

macOS / Linux

g++ -std=c++17 $(find src -name "*.cpp") -o main

Windows (MinGW)

g++ -std=c++11 -o main.exe src/main.cpp

Windows (MSVC)

cl src\main.cpp

5. Run the Program

macOS / Linux

./main

Windows

main.exe

6. Cleaning Build Files

Remove compiled binaries:

rm -f main main.exe

7. Notes

  • Use -std=c++11 or higher (e.g., c++17, c++20) depending on your needs
  • Keep source files in src/ and headers in include/ for organization
  • For larger projects, consider using a build system like CMake

8. Running Tests

g++ tests/unit/math_test.cpp -o test && ./test

9. Build

cd build
cmake ..
make

10. License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Gaming Engine Project

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages