Saturday 27 March 2021

Developing Linux programs in Visual Studio C++

 Developing Linux programs in Visual Studio C++

Though Raspberry PIs (and other Linux based machines) are well supported with development environments, the familiar Windows based Visual Studio does make it easier to develop applications, especially where the target machine is not particularly powerful.

The following uses the free Visual Studio Microsoft Visual Studio Community 2019 Version 16.9.2.

Set Up

Start the Visual Studio Installer from the Start button or by searching.

 


Update Visual Studio.

Once it has been updated, click on the Modify button (not quite as obvious as it could be).

Select the Linux C++ option (you need to scroll down a bit).


Click on the Modify button (bottom right).

Set up Linux machine

sudo apt-get install openssh-server g++ gdb make ninja-build rsync zip

Start SSH on the Linux machine (if not already started).

sudo service ssh start

First project

Start Visual Studio. Click File/New Project.

Search for Linux templates.

Start with a Console Application, suitable for any Linux machine.

This provides a bare bones “Hello World” C++ project.


 

Click on Build/Rebuild Project.

Visual Studio will ask for the Linux machines hostname,  username and password. The username and password should be a login on the Linux machine. Ensure that the Linux machine is configured to allow SSH through the firewall (see Simple Firewall oSimple Firewall r the Raspberry Pi Config program).

On the Linux machine you will find a folder called projects in the user folder. See below. 

Open a terminal on the Linux machine and change directory to this location.

To run the program enter.

./"Linux Console Application.out"

References

https://docs.microsoft.com/en-us/cpp/linux/download-install-and-setup-the-linux-development-workload?view=msvc-160

https://docs.microsoft.com/en-us/cpp/linux/create-a-new-linux-project?view=msvc-160


Saturday 6 March 2021

Raspberry Pi COBOL

COBOL

Introduction

COBOL is one of the oldest computer languages, having been created in 1959. COBOL is an acronym – “COmmon Business Oriented Language”.

The language grew out of a US Department of Defence requirement for a portable programming language for data processing.

Installation

sudo apt-get install open-cobol

First program

Use the Geany editor (Visual Studio Code might work as well)

       Identification Division.

       Program-ID. HelloWorld.

       Data Division.

       Procedure Division.

       Main-Paragraph.

       Display "Hello World"

       Stop Run.



Open a console window and change the directory to the location of the file.

Compile with

cobc -x -o hello HelloWorld.cbl


References

https://en.wikipedia.org/wiki/COBOL

https://en.wikipedia.org/wiki/GnuCOBOL

http://opencobol.add1tocobol.com/gnucobol/

http://rosettacode.org/wiki/Category:COBOL

https://gnucobol.sourceforge.io/doc/gnucobol.html