How to resolve the issue of command not found in Linux when using gcc?
If you encounter the error message “gcc: command not found” in Linux, it means that the GCC compiler is not installed on your system. To resolve this issue, you can follow the steps below:
- Firstly, use the following command to check if the system already has the GCC compiler installed:
gcc --version
If GCC is already installed in the system, it will display the version information; otherwise, it will prompt “command not found”.
- If GCC is not installed in the system, you can use the following command to install the GCC compiler:
To install on Debian or Ubuntu systems, use the apt command.
sudo apt install gcc
To install on CentOS or RHEL systems, use the yum command.
sudo yum install gcc
- What version of gcc are you using?
Please be aware that in certain Linux distributions, additional packages may need to be installed, such as build-essential or development tools, in order to install GCC and other development tools. The specific commands may vary, so please make adjustments according to your system and distribution.
I hope the above information is helpful to you!