Ubuntu Bash - Windows Subsystem for Linux

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
Site Admin
Posts: 2523
Joined: Fri Aug 13, 2004 5:10 pm

Ubuntu Bash - Windows Subsystem for Linux

Post by jussij »

Details on installing the Bash on Windows

Windows 10 recently added an option to run Bash on Windows using a Ubuntu based Linux subsystem.

Details on how to install that subsystem can be found here: https://msdn.microsoft.com/en-us/comman ... tall_guide

And more details can be found here: https://blogs.msdn.microsoft.com/wsl/20 ... -overview/

Also make sure you read this important information: https://blogs.msdn.microsoft.com/comman ... and-tools/

Zeus Enhancements for Bash
Once you have that subsystem up an running you can access it via Zeus just like any other compiler, shell or tool.

As an example consider the configuration shown below which lets you run the GNU C compiler and have it capture the error output, just as you would do if you were configuring a Windows compiler:
bash_compile.png (96.47 KiB) Viewed 36744 times
More Ways to Configure Zeus for Bash
The latest release of Zeus adds features that let you work with this subsystem and they are described below.

1. Bash Tool Menu Options

The Tools menu adds two new menu options as shown below:
bash_tool.png (84.63 KiB) Viewed 36744 times
The Bash Command Line menu allows you to bring up a dialog to run a bash command and have the output captured inside Zeus:
bash_dlg.png (4.19 KiB) Viewed 36744 times
The Bash Shell menu allows you to open up the Bash shell which is identical to the shell shown earlier.

2. Tools Options

The configuration of Tools now has an option to define a Bash commands as tools:
bash_tools.png (4.54 KiB) Viewed 36744 times
3. Compilers Options

To run the GNU C or C++ compilers you need to test to see if the compilers are installed.

For example to test if the C compiler is installed try running this command using the Zeus Bash command line optioned mentioned earlier:

Code: Select all

gcc --version
If this result in the following output message it means the compiler is not installed:

Code: Select all

The program 'gcc' is currently not installed.

To install the the C and C++ compilers open the bash shell and run these commands respectively:

Code: Select all

sudo apt-get install gcc
sudo apt-get install g++
With the compilers installed the new Compiler configuration options found in the document type can now be used to run these compilers as shown below:
bash_cmd.png (14.67 KiB) Viewed 36744 times
Using these options the Bash compiler command will be run from inside Zeus and the output captured.

4. Workspace Options

The workspace configuration now has an option to define Bash commands for the Project building options:
bash_make.png (27.32 KiB) Viewed 36744 times
Using this option the Bash make commands will be run from inside Zeus and the output captured.

5. File Editing Options
The Ubuntu subsystem automatically creates mount points in /mnt for each of the corresponding Windows drives.

For example, that means you can access the files on your C: drive from inside the Bash shell using the /mnt/c/ mount and vice versa.

This means you could edit the code on the Windows side and compile the code on the Bash side and the two sides will always be in sync via the mount point.

But one cause of trouble would be the different line encodings used by Windows and Linux.

Another source of problems would be the fact that Windows uses a BOM for UTF8 files where as Linux does not.

Both of these issues are easily resolved by configuring the Zeus document type to be Linux friendly as shown below:
bash_eol.png (126.52 KiB) Viewed 36739 times
With these settings in place Zeus will make sure the files are always Linux friendly.

This means you can do all the coding on the Windows side using Zeus, yet have that code compiled on the Linux side and this can all be do without leaving Zeus ;)
Post Reply