Switching between VMs, dealing with the unfamiliarity feeling of the different OS and windowing system, and having your work-in-progress source code spread across multiple systems can become rather annoying and easily lead to a loss of motivation.
For quite some time, I’ve been trying to get the Scancode feature finalized for SFML and experienced the described issue multiple times. One solution that closes the gap between Linux and Windows is to use WSL2, VS Code’s Remote Development extension pack and an XServer running on Windows.
I won’t go much into detail, as it can become rather complex, but merely link a few resources that might be of interest to future me or others wanting to replicate the setup.
- Make sure you have Windows 10 version 2004 or higher
- Install WSL2 with
wsl --installin an administrator PowerShell oder CMD
- Install all the tools you want or need, as you would on your Ubuntu VM
Code with Visual Studio Code in WSL2
- In your WSL shell navigate to the code and start VS Code with
- You don’t need to install anything as WSL will do it for you
- Install the Remote Development extension pack in the WSL2 VS Code instance
- For more details see Developing in WSL
Run X11 Apps on Windows with WSL2
- Taken from this StackOverflow answer with the necessary details
- Install VcXsrv Windows X Server
- Add some environment variables to tell the XClients where to find the XServer
- Start XLaunch on Windows
- Start a X11 application
Error: Can’t open display
Make sure the IP address is correct after the error message. If it’s not correct, then check the command that retrieves the host IP address in your
Also when starting XLaunch don’t forget to check “Disable access control”, so the WSL2 can connect to the server. Note: Depending on the network your in, this might pose a small security risk.
See also this GitHub issue for some more tips.
ldconfig: libcuda.so.1 is not a symbolic link
Might be totally unrelated to everything described here, but I had that error message whenever
ldconfig was executed. Basically, you need to the delete the copied files on the host system and create symbolic links in WSL2. See this GitHub issue for how to fix it.