Trouble adding compiler to windows path - c++

I'm having a seemingly silly problem with my gcc compiler. I have installed MinGW at location C:\MinGW... and I have added C:\MinGW\bin to my windows path. However, when I got to the command prompt and type gcc --version... it doesn't recognize it. I have to cd manually to the bin before it will recognize it.
When I go back to my windows path it shows it there... so I'm not sure what the problem is. Any ideas? Thanks!

How did you set the path? You should set it from Control Panel->System->Advanced->Environment Variables. The change will affect newly opened command consoles only.
If it then does not work, in the console, when you enter the command path does the displayed path list include your path? Is it correct?
Are ther other GNU toolchain paths that appear before the mingw one (Cygwin for example)?
Does the path contain spaces? Some ported GNU tools do not always work correctly with paths containing spaces.

Have you started a new command window? The path doesn't change in existing windows as you change the path through environment variables.
Do you see the desired path in the output of:
C:\> echo %PATH%

Related

Configuration of C++ on Windows OS

I installed the MinGW-w64 C/C++ package on C:\.
What are the system environment variables I should add into the Windows OS so that I can code in C/C++ on VS Code e.g. C:\MinGW-w64...\bin, etc?
You shoul add the path of the GCC compiler
mostly it should be like C:\MinGW\Bin
(here C:\ can also be something if you put that at some other place or a different drive, I normally install it directly in C drive and it works well)
Search for Path in Windows Search, you'll find an option of "Edit Environment and Path Variables"
Open it
Go to system variables (so it can be available to all users)
Click on the path, there will be some blank lines, paste your copied path from Windows Explorer, or click the browser option to browse it.
The main thing to add in path in MinGW\Bin which contains all compile binaries)
I hope you get what I went to say.

Launched failed. Binary not found c++ eclipse

I have no idea why my c++ file will not compile correctly. I added the MinGW installer in the right environment path. I selected my Binary parser to PE Windows Parser.
Open a command prompt from any folder and type make. Press enter. If it gives you a message like file not found, then you either do not have make on the path, or it was not installed with Mingw.
So if not found, first go to the Mingw folder and verify that you have a file called make.exe. If you don't, you need to reinstall (possibly with msys), if you do, then you need to make sure that the exact folder with make is on your path.
You can see what folders are on your path by running echo %PATH% in a command prompt.

libgmp-10.dll is missing

I recently installed MinGW on my 64-bit Windows 7 computer and when I attempt to compile the most basic of c++ programs, for example
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
I get the error that "The program can't start because libgmp-10.dll is missing from your computer."
Have you tried adding C:\MinGW\bin as a System variable Path (not PATH) in Settings->System Properties->Environment Variables?
I saw this solution on this page: Missing libgmp-10.dll
Go to the mingw download page and browse the following directories:
MinGW / Base / gmp / gmp-5.0.1-1
Currently you end up with the following link:
http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/libgmp-5.0.1-1-mingw32-dll-10.tar.lzma/download
and it contains the needed file.
I know there are automated methods for installing mingw gcc, but when one uses single mingw packages, then gmp is one of obligatory downloads.
added
c:/MinGW/bin to PATH
and restarted CMake-gui
worked for me
I came upon this question when I started CodeBlocks and then clicked on my project. After the project notes appeared and I pressed OK, the error appeared:
"System Error: The program can't start because libgmp-10.dll is missing from your computer.
Please reinstall the application to fix this problem."
I presse OK a bunch of times and then was able to do normal compile, link, etc. but that error showed up everytime I started C::B and went to the project. Then I noticed that the LLVM Clang compiler was my default compiler in the compiler settings, though GCC was set as the compiler specific to the project I was working on.
The solution was to set the compiler in the compiler settings to GCC (mingw) and also set it as the default compiler. After that this system error stopped popping up every time I started the project.
The reason I posted this answer is because it answers the OP's question and other people with the same question may have a similar reason for this irritation, and my personal experience in this matter may prove useful to those people.
If you did not find this file in your installation directory, and then went to the site [Click here] to download the file, and then extract it to your installation directory.enjoy:-)
Caution - removing stuff from your path can compromise your system!
Interestingly, you not only need to add the MinGW bin to your Path, but also you need to make sure that certain things are not on your path*. In my case, I saved my entire path variable as a backup, deleted everything non-system from my path except for MinGW and CMake, leaving:
C:\MinGW\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\CMake\bin
You should use the appropriate elements from your system path.
I first tried to do this with a batch job that launched CMake, but it seems that the CMake GUI was reaching back and grabbing the System 'Path' variable instead of the command prompt 'Path' variable, which I had printed and confirmed was as listed above before launching CMake.
Incidentally, I backed up the entire Windows VM before starting!
* For instance: various references, including known issues, mention sh.exe. I inherited this VM from my client and hacked it up further, so it's easier for me to use a clean path for my cross-compiling task and return afterward...
In just installed MinGW using the mingw-get-setup.exe v0.6.2beta-20131004-1 installer. Even though during the install I selected the gcc package, the installer didn't include the "mingw32-gmp" package, which includes libgmp-10.dll. I had to rerun the installer, chose the "Reinstall" option, and manually select the "mingw32-gmp dev" package.
If you don't have the permission modifying your global path, you can also change the active directory of your cmd shell.
How to do it (in the cmd shell):
C:\> cd C:\MINGW\bin
C:\MINGW\bin> gpp.exe C:\Users\James\Desktop\Program.cpp
How it doesn't work:
C:\>C:\MINGW\bin\gpp.exe C:\Users\James\Desktop\Program.cpp
Note: you have to change "C:\Users\James\Desktop\Programm.cpp" to wherever your program lays
How it works: windows looks for needed DLLs while in the same directory and if it can't find it there it'll look in the PATH variables (so it will search system32 by default), if you add any missing DLLs to the directory from where you run it, windows looks and uses them (even before it looks in the PATH).
A very simple fix to this problem of having missing driver file/s is to select and copy all the dll files from C:\MinGW\Bin and paste them into your C:\MyPrograms or whereever else your folder for created c++ (.cpp) files are being located.
Just search google for the dll file and download it. Then paste it into the folder in this path
C:\MinGW\libexec\gcc\mingw32\9.2.0

How do I add the MinGW bin directory to my system path?

I am using Windows XP. I am trying to add a new library to Dev-C++. For that, I need to install MinGW and then I have been instructed to add the bin directory of MinGW to my system path. But, I don’t know how to do it. Please guide me (step by step) to add this to my system path.
To change the path on Windows XP, follow these instructions, and then add the directory where you install MinGW plus bin. Example: if you install MinGW in C:\ then you have to add C:\mingw\bin to your path
Just for completeness here are the steps shown on the link:
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32;c:\mingw\bin

MinGW Compilation Problem

I just installed MinGW using the automatic installer MinGW-get-inst that I found on their website. I am using eclipse to write my C++ programs. My code compiles fine, and I get a .exe file. However, when I try to open this executable, I get the error that libgcc_s_dw2-1.dll is missing from my computer. I have located this file under MinGW\bin so I know it exists.
This is for all C/C++ programs, I am testing with a simple hello-world program. Any fixes?
Thanks
You need to ensure that the MinGW\bin directory is on the path from where you are running application.
If you were running the resulting executable, say a.exe for example, from a CMD window do the following to check that MinGW\bin is on the path.
set PATH
At this point you will see the current value for the command path. Make sure the MinGW\bin directory is in it somewhere.