Waiting for Godot.

github

Installing Raylib on Windows

I don't know why but Raylib seems to be one of those things that looks really easy to get into from outside. But once you try to get into Raylib, it burns your house down and steals your bank account.

I am writing this to make sure those things don't happen.

However, do note that this short 'guide' will only be for Windows using Visual Studio. Also, I won't be showing how to import examples. It is quiet easy to figure out if you really want them in your workspace but Raylib's examples page is good enough in my opinion.

Install Visual Studio

Go over here and download the latest version of the visual studio. For this guide I'll be using community edition 2022. Once you got the installer ready to go make sure you choose "Desktop development with C++" under Workloads tab.

img1.png

Now once that is done, create a new empty project

img2.png

Using vcpkg

Now we are going to start following the guide over at Raylib's github page for vcpkg.

Now at this point if you don't have git, go get it we need to use it to setup vcpkg

Open up a terminal on visual studio, its located under View > Terminal. I usually use powershell but you can also use the command prompt for this.

Now here is the magical part as it says in the wiki enter the following commands to setup vcpkg for the project they are slightly different compared to the ones on wiki as I use powershell.

    git clone https://github.com/Microsoft/vcpkg.git
    cd .\vcpkg\
    .\bootstrap-vcpkg.sh
    .\vcpkg.exe integrate install
    .\vcpkg.exe install raylib

I've also discovered in certain setups calling the install raylib is not enough for running on x64. Calling the following command allows running x64 debugger:

   .\vcpkg.exe install raylib:x64-windows

Testing

Once that's done you should refresh Visual Studio and raylib should work! Just create a new .cpp file, call it main.cpp and plugin the code below:

#include "raylib.h"

int main()
{
    InitWindow(800, 450, "raylib [core] example - basic window");
    SetTargetFPS(60);
    while (!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(RAYWHITE);
        EndDrawing();
    }
    CloseWindow();
    return 0;
}

Build the project and use the local windows debugger to fire it off. Depending on your setup, you might get some errors for that I suggest using x86 instead of x64 this seem to solve most of the problems.