2022. november 16., szerda

POSIX development on windows

 With Windows Subsystem for Linux (WSL for sort) you can do all sorts of amazing things, including developing POSIX compatible code, all in your favorite (?) Windows environment. Let's get to it, it is less complicated than it looks.

Install WSL

It should be as simple as running this from an administrator command line:
wsl --install
If it does not work for you, you may need to tweak your BIOS settings, install windows features, or something else. This article should be a good starting point for your troubleshooting.
I will be using the default (Ubuntu) installation as an example.
If all went well, you can start your linux machine from the cmd line with "wsl" or from the start menu as "Windows Subsystem for Linux". Do it now.

Install linux tools

An example list, tweak it to your taste:
sudo apt install  gcc gdb valgrind make pkg-config doxygen 

Install VS Code and tools

I am 99% sure you have VS code installed already. If not, you can find some resources here.
WSL for VS Code is a funny little beast, unless you are familiar with the split brains approach (some other languages use this as well), it might worth try to look at it here.
Long story short, Remote Development extension pack is all you need to work with your WSL.
C/C++ Extension Pack might also be interesting.

To be continued...