# Set up Your Environment

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/)
- [Compiler basics](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/1/)
- [Set up Your Environment](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/2/)
- [Find specific Neoverse features](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/3/)
- [Try an example application](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/4/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/cplusplus_compilers_flags/_next-steps/)

## Connect to an AWS Arm-based instance

In this Learning Path, you’ll build and run a C++ application on any Neoverse-based system running Ubuntu 24.04 LTS. For example, you can use the Arm AGI CPU or an AWS Graviton 4 (`r8g.xlarge`) instance. Both are based on Arm Neoverse architecture and provide an Arm-native development environment.

> **Note**  
> If you are new to cloud computing, see [Getting started with Servers and Cloud Computing](https://learn.arm.com/learning-paths/servers-and-cloud-computing/intro/). It provides an introduction to the Arm servers available from various cloud service providers.

### Get set up

Connect to your instance using SSH or your preferred remote access method so you can enter shell commands.

Once connected, run the following commands to confirm the operating system and architecture:

```bash
cat /etc/*lsb*
```

You should see output similar to:

```
__output__
DISTRIB_ID=Ubuntu
__output__
DISTRIB_RELEASE=24.04
__output__
DISTRIB_CODENAME=noble
__output__
DISTRIB_DESCRIPTION="Ubuntu 24.04.4 LTS"
```

Next, confirm that you are using a 64-bit Arm-based system using the following command:

```bash
uname -m
```

You should see the following output:

```
__output__
aarch64
```

## Install Different Versions of the GNU Compiler Collection

An effective way to achieve optimal performance on Arm is not only through optimal flag usage, but also by using the most recent compiler version.

Older compilers might not fully leverage the latest hardware features, particularly when targeting cutting-edge Arm processors, resulting in less optimized code.

In your terminal, run the following commands to install the most recent version of the GCC, as of May 2026, version 16. This is an experimental version pulled from the Ubuntu toolchain repository. You may need to press enter when prompted:

```bash
sudo apt update
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-16 g++-16 -y
```

Directly run the `g++-16 --version` command to confirm you have the same output as below:

```
__output__
g++-16 (Ubuntu 16-20260315-1ubuntu1~24~ppa1) 16.0.1 20260315 (experimental) [trunk r16-8100-g3aca3bae8ee]
__output__
Copyright (C) 2026 Free Software Foundation, Inc.
__output__
This is free software; see the source for copying conditions.  There is NO
__output__
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

> **Tip**  
> You can set up the default compiler using the following command and priority. This enables build systems such as CMake to choose the latest version of the compiler and is more convenient to simply type `gcc` compared to `gcc-16`.

```bash
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 200
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-16 200
```
