Configure: error: no acceptable c compiler found in $path
Do you encounter this error while installing a program? Do you intend to find a solution to it? You've come to the right place if that's the case. Today, we will understand how to resolve this particular error.
The error occurs when the GCC compiler is not installed or the gcc compiler location is missing in
$path variable. Let's first know about compiler and $path variable.
Scroll for More Useful Information and Relevant FAQs
Shedding light on $path variable
$path variable is a path environment variable on an operation system like Unix, OS/2, Windows etc. It specifies the location of the executable program.
On windows Operating System, the $path variable name is specified by directory names separated with semi-colon.
C:\windows\system32 is the first path followed by various directory names. It includes only names which need to be executed with command prompt not graphical user Interface.
When a command is entered in command shell or command prompt, first the system will search it in the current directory and then search in all the directories tracing from left to right looking for a filename given in the command. The extensions for executable files are .exe or .com. As soon as the executable file matches, the system starts the new process. So, the current process will either wait or terminate. The system get slows down if we provide too many locations in the path variable.
How to Install and run GCC compiler on windows?
In this section, we are going to learn about how to install and run the GCC compiler on Windows. Before diving into the topic, let's understand about compiler.
Knowing about compiler
Compilers are used to convert a source code into a machine-readable code, that is, a series of ones and zeros, that a machine can understand. To compile a programming language, we need a compiler. Coming to C programming language, there are two ways to set up a compiler.
- By installing C/GCC compiler manually.
- By installing Code::Blocks or IDE and then embed the GCC compiler during installation.
Here we are going to install it using code blocks. After installing the compiler, we need to set its environment path variable.
Steps to Install and run GCC compiler on windows
- Head on towards your Favourite browser and type code blocks.
- Click on Code Blocks download, you will get this in Search.
- Click on the Code Block website link.
- You will be redirected towards the official site of Code::Blocks. On the very top, we can see the downloads section. Click on download the binary release.
- Scroll down to the next page you get after clicking Binary release and click for applicable OS (Here we choose for Windows).
- As you click on this link, you can see a lot of links. Download codeblocks-20.03mingw-setup.exe. You can download it from any of the given links as shown in the image.
- As soon as you click the link, the file will start to download on your system. Now, go to downloads on your system, and click on the downloaded file.
- Double-click on the file to start installing it.
- After that, a prompt will open Do you want to allow this app to make changes? Click YES.
A window will appear as shown below, click on next -> I agree ->Choose destination folder and click Install. Remember, it's better to keep the default settings such as files to download or destination folder.
- After installation gets complete, you will get a window like this. Click YES.
- Then the code blocks window will open. Click OK.
- So, we can see the Code: blocks window where we can simply create a project and execute our programs.
- Now, coming to the command prompt we will check if gcc is there on our system.
Follow the steps below:
- Open the command prompt.
Type gcc and press enter. You can see this error here.
- This is because we haven't set the environment variable yet.
How to set the path of the environment variable?
Following are the steps to set the environment variable:
- Go to C directory of your system.
- Then go to program files -> code blocks folder -> MinGW folder -> bin.
- This folder contains all the executables.
- Next, copy the path C:\Program Files\CodeBlocks\MinGW\bin.
- Our next step is to add this path to the environment variable.
- Search for the environment variable in your system and click on it.
- Then go to environment variables.
- Then go to New and add variable name and variable value(means the address) there.
- You can browse the directory and add as well, go to c -> program files- > code blocks -> MinGW -> bin
- Click OK.
- Now, again open the command prompt and write gcc.
Concluding my words, I would like to say that if you ever encounter the error configure: error: no acceptable c compiler found in $path, then the issue can be fixed by installing C compiler on your system and set the path of the environment variable. I hope you gained some knowledge by reading this piece of content and hope it helps. Keep connected with us for more technical information.
How to Install and run GCC compiler on Linux computer?
When we install a package that has to be compiled in C but doesn't exist in the $path variable, build complains about a similar
error: No appropriate C compiler could be found in the $path on RHEL/CentOS/Ubuntu/Debian
In this situation, let's first see if the system has the necessary C compiler installed. It is often a GNU C compiler.
To verify that gcc is installed, use the following command.
Therefore, if gcc is installed, corresponding installation information will be shown. However, it would be preferable if we choose to install the build-essential package. The reason it is regarded as a meta-package installation is as follows.
Build-essential are required for package compilation. All dependencies should be linked together to aid with dependency problems that might arise during the compilation of C and C++ programs. A meta-package called build-essential contains tools, standard C headers, and development libraries that are needed to compile applications and are crucial for some Debian packages.
Run the following command to install build-essential if you are using Ubuntu.
sudo apt-get install build-essential
Try the following command if you're using CentOS or RHEL.
Sudo yum groupinstall "Development tools"
Before installing build-essential, it is advised to run
apt-get update to ensure that the most recent installation package is accessible as there is a chance that you could encounter an error stating the repository cannot locate the installation package.
After installing development tools, the following will be installed.
- GNU debugger
- g++/GNU compiler collection
- standard C headers
Are you still using outdated operating systems?
Yes, that is certainly one of the possibilities. Please make sure it's not the outdated version, upgrade, and try again. Upgrades will also aid with security patches.
Please be aware that some of your prior packages (or applications) may not respond as expected if you upgrade, thus you should upgrade cautiously and we advise checking on any testing servers.