This Tutorial teaches you how to create a lightweight environment for D++-development using WSL and Visual Studio Code
- Note
- This Tutorial will use WSL's default Ubuntu! You might use other Distros if you prefer, but keep in mind the setup process might be different!
- Make sure you have installed your WSL 2 environment properly using this guide to setup up WSL and this guide to connect to Visual Studio Code.
- Now open PowerShell as an Admin and type
wsl
to start up your subsystem. - Note
- If you want to set up a CMake project (recommended for production bots) now, consider continuing your path of becoming the master of all Discord bots here, otherwise keep following this guide!
- Go to your home directory using
cd ~
- Download the latest build for your Distro using
wget [url here]
. In this guide we will use the v10.0.0 build for Ubuntu x86-64: wget https://github.com/brainboxdotcc/DPP/releases/download/v10.0.0/libdpp-10.0.0-linux-x64.deb
- Note
- replace the highlighted filenames with the package you downloaded earlier if you are using a different OS
- Finally install all required deps and the library using
sudo apt-get install libopus0 && sudo apt-get install -y libopus-dev && sudo apt-get install -y libsodium-dev && sudo dpkg -i
libdpp-10.0.0-linux-x64.deb && rm
libdpp-10.0.0-linux-x64.deb
Congratulations, you've successfully installed all dependencies! Now comes the real fun: Setting up the environment! For this tutorial we'll use a as small as possible setup, so you might create a more advanced one for production bots.
- Navigate to a folder of your choice using
cd your/path/here
or create a new directory using mkdir MyBot && cd MyBot
- Now that you've a folder to work in type
> mybot.cxx
to create a file you can work in!
- Now you can open this file in Visual Studio Code by pressing
CTRL+SHIFT+P
and typing Remote-WSL: New WSL Window
. This will bring up a new window. In the new window, choose open folder
and choose the folder you've created prior. Press OK and now you have your Folder opened as a Workspace!
- Add code to your CXX file and compile it by running
g++ -std=c++17 *.cxx -o bot -ldpp
in the same folder as your cxx file.
- start your bot by typing
./bot
!