Categories
C Programming Languages

Install raylib and Setup Visual Studio Code for Windows

Assumed that MinGW-64 (C/C++ compiler) have been installed and system environment variable (Path) setup.

Download the raylib from GitHub and extract it

https://github.com/raysan5/raylib

Build raylib using make

Using MinGW make a tool, just navigate from the command line to raylib/src/ folder and type:

mingw32-make PLATFORM=PLATFORM_DESKTOP
librarylib.a created mean build has been successful

Project folder structure

Example (main.cpp)

#include "raylib.h"

int main(void)
{
    InitWindow(800, 450, "raylib [core] example - basic window");

    while (!WindowShouldClose())
    {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }

    CloseWindow();

    return 0;
}

Makefile

default:   

g++ ../main.cpp -o test.exe -O2 -Wall -Wno-missing-braces -I ../include/ -L ../lib/ -lraylib -lopengl32 -lgdi32 -lwinmm

Run

mingw32-make

Binary (/build)

test.exe