How should the gcc environment variables be configured in Ubuntu?
To set up the GCC environment variable on Ubuntu, please follow these steps:
- Open the terminal (shortcut: Ctrl + Alt + T).
- Enter the following command to install the GCC compiler:
sudo apt-get update
sudo apt-get install build-essential
- Run the following command to check the version of GCC:
gcc --version
- Use the following command to find the installation path of GCC:
which gcc
- Open the bashrc file (used for configuring environment variables):
gedit ~/.bashrc
- the directory where executable files are stored
export PATH=/usr/bin:$PATH
- Save the file and then close it.
- Enter the following command to apply the configured environment variables:
source ~/.bashrc
You have now successfully set up the GCC environment variables. You can now use GCC to compile programs in the terminal.