cuda-g++ command not found

In this troubleshooting guide we learn how to fix cuda-g++ command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

cuda-g++: command not found

or when using sudo you get the following error message

sudo: cuda-g++: command not found

Solutions to cuda-g++: command not found

How To Fix cuda-g++: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu cuda-g++ is provided by nvidia-cuda-toolkit-gcc package.

nvidia-cuda-toolkit-gcc is:

The Compute Unified Device Architecture (CUDA) enables NVIDIA graphics processing units (GPUs) to be used for massively parallel general purpose computation.

This package provides the /usr/bin/cuda-gcc, /usr/bin/cuda-g++ symlinks to simplify building packages that need to be built with a CUDA-compatible compiler.

To fix this problem, we can install more using the command below.

sudo apt-get -y install nvidia-cuda-toolkit-gcc

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install nvidia-cuda-toolkit-gcc.

sudo apt -y install nvidia-cuda-toolkit-gcc

Or if you have aptitude installed you can use the following command.

sudo aptitude install nvidia-cuda-toolkit-gcc

Summary

In this tutorial we learn how to fix cuda-g++ command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.