From e5dc246980dc34ab6b82a3ed5d6f639744595876 Mon Sep 17 00:00:00 2001 From: Marcus Sanatan Date: Sun, 30 Jan 2022 19:21:46 -0400 Subject: [PATCH] Add steps for users on Windows with Windows Subsystem for Linux shell as their default --- Using-raylib-in-VSCode.md | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Using-raylib-in-VSCode.md b/Using-raylib-in-VSCode.md index 484183d..4aba932 100644 --- a/Using-raylib-in-VSCode.md +++ b/Using-raylib-in-VSCode.md @@ -3,28 +3,47 @@ Note: Make sure you install Raylib from the official release binaries rather than building Raylib from source (should work without changes on Windows if you install Raylib mingw release). ### Step 1 -Copy the VSCode folder (and all its contents) from raylib/projects/VSCode (from your installed directory) to your desired project location. These files can also be found [here.](https://github.com/raysan5/raylib/tree/master/projects/VSCode). + +Copy the VSCode folder (and all its contents) from raylib/projects/VSCode (from your installed directory) to your desired project location. These files can also be found [here](https://github.com/raysan5/raylib/tree/master/projects/VSCode). **Note**: You can use this [Zip Tool](https://kinolien.github.io/gitzip/) to download only the VSCode folder as a zip. ### Step 2 + Make sure you set the proper paths to your local build of raylib in c_cpp_properties.json and tasks.json. These will be specific to your installation of raylib. in **c_cpp_properties.json** make sure -`"includePath": [ + +```json +"includePath": [ "C:/raylib/raylib/src/**", "${workspaceFolder}/**" -],` +], +"compilerPath": "C:/raylib/mingw/bin/gcc.exe", +``` + +in some cases it's **mingw32** instead of **mingw** (which comes with installer v2.0). In version 4, the compiler path is as follows: + +```json +"compilerPath": "C:/raylib/w64devkit/bin/gcc.exe", +``` -`"compilerPath": "C:/raylib/mingw/bin/gcc.exe",` -in some cases it's **mingw32** instead of **mingw** (which comes with installer v2.0). Check your folder to see which one you have. In **tasks.json** also you have to make this change for compile to occur. +Check your folder to see which one you have. In **tasks.json** also you have to make this change for compile to occur. + +#### Extra Configuration for Windows Subsystem for Linux Users + +If you are on Windows and use [Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/) with the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about) as your default shell, you won't be able to debug or build your game with the default settings. That's because the build configuration will try to launch `cmd` to open a standard Windows shell which won't exists in your Linux distribution. + +To make it work, edit launch.json in the `.vscode` folder so that the `externalConsole` property is `true` instead of `false`. You need to make this change **twice** i.e. you should see `"externalConsole": true,` in both configurations. ### Step 3 + Install the "C/C++" VSCode extension. (From Menu - **File > Preferences > Extensions**) ### Step 4 + Try launching by using the "Debug" launch configuration in the Debug tab. _or_ -You can Build the game using **View > Command Palette** (or Ctrl + Shift + P), Type **Run Task** and press **Enter**. And Select the **Build Debug** option. A game executable will be created in the project folder. You can see any error in the console \ No newline at end of file +You can Build the game using **View > Command Palette** (or Ctrl + Shift + P), Type **Run Task** and press **Enter**. And Select the **Build Debug** option. A game executable will be created in the project folder. You can see any error in the console