Skip to content
Vitor Mouro edited this page Apr 21, 2023 · 68 revisions

Building raylib on Windows

Simple Setup using Premake

The fastest way to get a game setup on windows with MinGW or Visual Studio is to use premake. See raylib-extras/game-premake for instructions

Or watch the video tutorial here

https://www.youtube.com/watch?v=--gI9083QnU

Installing and building raylib via vcpkg

You can download and install raylib using the vcpkg dependency manager:

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

The default triplet in vcpkg is set to "x86-windows". If you want to install x64 version instead, you should use following command:

  vcpkg install raylib:x64-windows

The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.


Installing and building raylib via conan

You can download and install raylib using the conan dependency manager:

  https://docs.conan.io/en/latest/getting_started.html

The raylib recipe in conan is kept up to date by conan team members and community contributors. If the version is out of date, please create an issue or pull request on the conan-center-index repository.


Raylib already comes with ready-to-use makefiles and CMake build system to compile source code, examples and templates. You can download the raylib Windows Installer.

The raylib Windows Installer comes with all the required tools to develop with raylib, those tools are:

  • C Compiler (TCC or MinGW) - To compile the code, it includes all required system libraries.
  • Notepad++ (preconfigured) - To edit code, it includes ready-to-use scripts to compile code and examples.
  • raylib library - Including, source, release, examples and templates.

If you want, you can use a different code editor (e.g. Visual Studio) or another compiler.


The instructions below are focused on compiling raylib using Notepad++ as the editor and TCC or MinGW as the compiler:

Build raylib using Notepad++ script

Just open raylib/src/raylib.h source file on Notepad++ and execute (F6) the script raylib_source_compile

Build raylib using make

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

mingw32-make PLATFORM=PLATFORM_DESKTOP

By default raylib is compiled for OpenGL 3.3 Core backend; to compile for OpenGL 1.1 just type:

mingw32-make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_11

Building Examples

Build example using Notepad++ script

Just open your example source file on Notepad++ and execute (F6) the script raylib_compile_execute

Build ALL examples using make

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

mingw32-make PLATFORM=PLATFORM_DESKTOP

Build ONE example using gcc/g++

Open w64devkit.exe in C:\raylib\w64devkit then cd to c:/raylib/raylib/examples/core and type:

gcc core_basic_window.c -lraylib -lopengl32 -lgdi32 -lwinmm

This will output a.exe to the current directory, where you can run it with ./a.exe.

Building raylib project with VC (CL.exe) in Command-Line-Environment

A tool has been created to ease this specific approach to building raylib: VCrayApp

VCrayApp is a project-folder organization that is useful for creating Microsoft Windows programs using the raysan5/raylib library for graphical applications.

Clone this wiki locally