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.
-
thank you for your solution but what file must I copy the VS code file from Raylib into? – josephi Sep 08 '20 at 10:08
-
Please refer to the official guide on this very topic : [Using raylib in VSCode](https://github.com/raysan5/raylib/wiki/Using-raylib-in-VSCode). – brc-dd Sep 08 '20 at 10:09
-
@ josephi I don't get what are you asking in the above comment. Can you please rephrase it? – brc-dd Sep 08 '20 at 10:10
-
when it says "Copy the VSCode folder (and all its contents) from raylib/projects/VSCode (from your installed directory) to your desired project location." i dont know where the project location is – josephi Sep 08 '20 at 10:22
-
is it a project that you make? – josephi Sep 08 '20 at 10:22
-
Yeah, you first need to create a folder in which you want to keep your project source. There you need to move the downloaded `.vscode` folder and the make files. – brc-dd Sep 08 '20 at 10:23
-
I am still having trouble. would you mind sending me a video on it please. – josephi Sep 08 '20 at 10:30
-
Which OS are you on? – brc-dd Sep 08 '20 at 10:30
-
i am on windows 10 – josephi Sep 08 '20 at 10:32
-
I am unable to find any proper video, please consider going through the answer I just posted. If you face any difficulty then please add a comment on the answer. – brc-dd Sep 08 '20 at 10:39
-
ok, thank you brc-dd. – josephi Sep 08 '20 at 10:40
2 Answers
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) :
Install Raylib from the official release binaries (Install using
raylib_installer_v300.mingw.exe
on Windows).Install VSCode.
Now create a folder (say
my_project
) in which you want to keep the files of your project.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
Modify the paths inside in the files if
gcc.exe
is not there inC:/raylib/mingw/bin/
.Then open VSCode in the folder you made (right-click on folder and open with VSCode).
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.

- 10,788
- 3
- 47
- 67
-
I can't get it to work so I will just use the IDE that Raylib comes with but thank you anyways – josephi Sep 08 '20 at 11:14
-
@josephi Can you tell me any specific problem that's occurring to you during the setup? – brc-dd Sep 08 '20 at 11:15
-
-
1@josephi Are you sure you are opening the whole folder and not just a file? Open VSCode and press `Ctrl + K` followed by `Ctrl + O`. Then choose the `my_project` folder to open. It will open the workspace for you. There on left side you must see `.vscode` folder and `main.c` files. – brc-dd Sep 08 '20 at 12:22
-
@brc-dd Could you elaborate more about Step 1? I downloaded the raylib file (`raylib-4.2.0_win64_mingw-w64.zip` in my case) but I'm not sure how to install it. Where do you find `raylib_installer_v300.mingw.exe` and how do you use it to install the raylib file? – Ogiad Nov 04 '22 at 22:32
-
1@Ogiad Check the releases, there will be a file named `raylib_installer_vXXX.mingw.exe`. (version will be different depending on the release). – brc-dd Nov 05 '22 at 03:17
-
1Try adding C:\raylib\w64devkit\bin to your PATH environment variable and then restart whichever terminal you're using. This did the trick for me. – Nick Nov 10 '22 at 14:19
-
@brc-dd, Thanks to your help, I can now run the example code (rotating cube) with F5 key. However, when I try to compile the code with 'Run code' , I get an error message saying "fatal error: raylib.h: No such file or directory" – Ogiad Nov 10 '22 at 20:07
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.

- 1,393
- 1
- 14
- 22