In most of my projects I use Visual Code, but for this I decided to go with Visual Studio out of custom from working in Unity. I used to be daunted by setting up a project in VS until I cracked how to get raylib working on it, and it has been a breeze ever since.

So if you want to use Visual Studio Community for your raylib projects, you are in luck! I am going to show you how.

At time of writing, I am using Visual Studio Community 2022.

Here is how I do it:

  1. Start a new empty C++ project.

  2. Download your desired version of raylib from here. Make sure it matches your computer’s bit architecture. Store it somewhere safe.

    • My computer is x64 but I have not been able to figure out how to get that working, so I use the x86 version. If you know how to fix that, please contact me!
  3. Extract the zip you downloaded in the previous step to that folder.

    • I usually rename to raylib-x.y, being x.y the version I am using.
  4. Create a new main.cpp file and paste something to it. I recommend the basic window example from the web.

  5. Choose your solution’s name and open up properties (Alt + Enter).

    • There is a dropdown at the top of the window. Choose All platforms if it’s not chosen already.

    • Go to > C/C++ > General > Additional Include Directories and paste the path to the include folder in your raylib version.

      • For example: ./raylib-5.5/include
    • [Optional] Go to > C/C++ > Preprocessor > Preprocessor Definitions and add GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;.

    • Go to > Linker > General > Additional Library Directories and paste the path to the lib folder in your raylib version.

      • For example: ./raylib-5.5/lib
    • Go to > Linker > Input > Additional Dependencies and add raylib.lib;winmm.lib;.

    • Apply and accept these changes. Close the window.

  6. Look at the top of VS’s window. Choose the right bit version in the Debug dropdown, matching the one you chose for raylib.

  7. Now hit the ▶ right next to it.

  8. ???

  9. Profit!

If you made it this far...

Thank you! I hope you liked it!

I do not allow comments in my blog because I do not want to deal with bots. However, feel free to contact me!

And if you would like to support my work, please, consider doing so through ko-fi:

Support me!