-2

I want to code using C++. How can I run my program using the terminal? It shows the following message.

GCC: command not found

screenshot

apaderno
  • 825

2 Answers2

1

If you are trying to compile your code with gcc, you need to use gcc as the command. Commands in bash are case sensitive.

chraffx
  • 185
1

Bash, like other Linux shells, is case sensitive: GCC is not the same as gcc, and you want to use gcc.

If even gcc doesn't work, it means:

  • You didn't install it, which you should do with the following commands.

    sudo apt-get install build-essential
    sudo apt-get install gcc
    
  • The command is not in your $PATH. In this case try first env | grep path, and then gcc hello.c -o hello1. If it doesn't work, find where gcc is with find . -name gcc, and add its path with export PATH=$PATH:/path/to/gcc. (Replace /path/to/gcc with the path where gcc was find with the previous command.)

apaderno
  • 825