-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Working on Windows
There are several ways to get setup on windows. This page will go through them from the easiest to the most difficult.
For compilers on windows there are two popular choices.
This is the industry standard IDE for working on windows. A free version is available as the community edition. https://visualstudio.microsoft.com/vs/community/ Note Visual studio is large and somewhat resource intensive, you should have a recently modern computer to use it.
This is an open source C/C++ toolchain that is very lightweight. The best way to get MinGW-W64 and GCC is via the W64Devkit https://github.com/skeeto/w64devkit/ Download the w64devkit zip file, unzip it and run W64Devkit.exe. that will give you a terminal that is ready to go.
Note that old MinGW (Not w64) from mingw.org will not work with raylib. You need to use MinGW-w64.
The game premake system is quite honestly the simplest way to get started on windows. It is a solution that uses premake to generate a build system specifically for raylib for you. It handles everything including setting up raylib.
https://github.com/raylib-extras/game-premake
It works with many compilers on windows, linux and mac OS.
Simply follow the instructions in that link and you will be done. If you use game-premake you can ingore the rest of this document
If you do not want to use game-premake, you have several options
Using MinGW make tool, just navigate from command line to raylib/src/
folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
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.
The instructions below are focused on compiling raylib using Notepad++ as the editor and TCC or MinGW as the compiler:
Just open raylib/src/raylib.h
source file on Notepad++ and execute (F6) the script raylib_source_compile
Raylib includes all of it's own external dependencies on windows. There are 3 system libraries that need to be linked to raylib for a game to work.
- OpenGL32: This is the Windows interface to the OpenGL API that raylib uses for drawing.
- GDI32: This is the interface to the window setup and drawing functions that raylib and GLFW need to work on Windows.
- WinMM: This is contains the high resolution timer code used by GLFW for precise timing in the game loop.
Just open your example source file on Notepad++ and execute (F6) the script raylib_compile_execute
Using MinGW make tool, just navigate from command line to raylib/examples/
folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
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
.
cl gdi32.lib kernel32.lib msvcrt.lib opengl32.lib raylib.lib shell32.lib user32.lib winmm.lib filename.c -Ic:\path\to\raylib\include /link /libpath:c:\path\to\raylib\lib /NODEFAULTLIB:libcmt
www.raylib.com | itch.io | GitHub | Discord | YouTube
- Architecture
- Syntax analysis
- Data structures
- Enumerated types
- External dependencies
- GLFW dependency
- libc dependency
- Platforms and graphics
- Input system
- Default shader
- Custom shaders
- Coding conventions
- Integration with other libs
- Working on Windows
- Working on macOS
- Working on GNU Linux
- Working on Chrome OS
- Working on FreeBSD
- Working on Raspberry Pi
- Working for Android
- Working for Web (HTML5)
- Working on exaequOS Web Computer
- Creating Discord Activities
- Working anywhere with CMake
- CMake Build Options
- raylib templates: Get started easily
- How To: Quick C/C++ Setup in Visual Studio 2022, GCC or MinGW
- How To: C# Visual Studio Setup
- How To: VSCode
- How To: Eclipse
- How To: Sublime Text
- How To: Code::Blocks