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.
1. 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.
2. How to Install and run GCC compiler on windows?
In this section, we are going to learn about how to install and run GCC compiler on windows. Before diving into the topic, let’s understand about compiler.
Knowing about compiler
Compiler 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 official site of Code::Blocks. And on the very top we can see downloads section. Click on download the binary release.
- Scroll down 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, its better 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 Code:blocks window where we can simple create a project and execute our programs.
- Now, coming to command prompt we will check if gcc is there on our system.
Follow the steps below:
- Open 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 path of 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 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 directory and add as well, go to c -> program files- > code blocks -> MinGW -> bin
- Click OK.
- Now, again open 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.