josephi
josephi

Reputation: 121

How to add Raylib to VS code?

I am a beginner at c++ and I would like to use raylib with vscode instead of using notpad++. does anybody know how to add raylib to vscode.

Upvotes: 5

Views: 28413

Answers (2)

Nick
Nick

Reputation: 1423

The most straightforward approach to start using raylib in Visual Studio Code is to download a pre-configured template.

If you have raylib installed in the default directory on the C drive (C:\raylib), this template should work seamlessly without any additional modifications.

https://github.com/educ8s/Raylib-CPP-Starter-Template-for-VSCODE

To get started, simply download the raylib template and double-click on the main.code-workspace file. This will open Visual Studio Code with the project loaded.

In addition, make sure you have the C++ extension installed in Visual Studio Code.

Press F5 on your keyboard and you should see a bouncing ball example.

Upvotes: 0

brc-dd
brc-dd

Reputation: 12964

Here is the official guide on this topic : Using raylib in VSCode.


I am re-writing the instructions mentioned in the link (in simplified form) :

  1. Install Raylib from the official release binaries (Install using raylib_installer_v300.mingw.exe on Windows).

  2. Install VSCode.

  3. Now create a folder (say my_project) in which you want to keep the files of your project.

  4. Download files from this link and copy them into the folder you made at above step.


This should result in the following structure :

my_project
 |- .vscode
 |    |- c_cpp_properties.json
 |    |- launch.json
 |    |- settings.json
 |    |- tasks.json
 |- Makefile
 |- Makefile.Android
 |- main.c
 |- main.code-workspace

  1. Modify the paths inside in the files if gcc.exe is not there in C:/raylib/mingw/bin/.

  2. Install C/C++ for Visual Studio Code Extension.

  3. Then open VSCode in the folder you made (right-click on folder and open with VSCode).

  4. Open main.c file, press press F5. Your code should compile and run on debug mode.


If you face any problem in following the step by step instructions then please add a comment.

Upvotes: 9

Related Questions