WSL2 - Install Linux C/C++ Compilers

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2547
Joined: Fri Aug 13, 2004 5:10 pm

WSL2 - Install Linux C/C++ Compilers

Post by jussij »

1. Open a Windows command prompt and run the wsl.exe to access the Linux subsystem.

2. Updating the packages list using this command:

Code: Select all

sudo apt update
3. Install the [i]build-essential[.i] package using this command:

Code: Select all

sudo apt install build-essential
This command will install everything to run the gcc, g++ and make tools.

3. Optionally you can install the manual pages for these tools using this command:

Code: Select all

sudo apt-get install manpages-dev
4. To test the C compiler installation run this command:

Code: Select all

gcc --version
That command should result in this output:

Code: Select all

gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5. To test the C++ compiler installation run this command:

Code: Select all

g++ --version
That command should result in this output:

Code: Select all

g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Running these Compiler from Inside Zeus

The Zeus compiler and tool configurations have an option to run the command using Bash. This equates to running the compiler or tool from inside the Linux subsystem.

This means you can run the Linux compilers inside Zeus and have the output captured in the editor.
For example the image below shows the compiler settings required:
wsl-compile.png
wsl-compile.png (109.65 KiB) Viewed 10727 times
The compiler command line used is as follows:

Code: Select all

g++ "$f" -g -o "$fb".o
That command line is expanded used the details (file name and file base name) of the currently active file.
Post Reply