Although an old question, none of the answers here helped me. The only route I found to get to my destination is by typing in the following line in my command prompt:
set Path=C:\MinGW\bin;%PATH%
After that, simply type in gcc -v.
Hope this helps anyone with the problem I had!
Answer from user7943 on Stack OverflowAlthough an old question, none of the answers here helped me. The only route I found to get to my destination is by typing in the following line in my command prompt:
set Path=C:\MinGW\bin;%PATH%
After that, simply type in gcc -v.
Hope this helps anyone with the problem I had!
In my case, the C:\msys64\mingw64\bin was empty.
And gcc was installed at C:\msys64\ucrt64\bin
So, adding C:\msys64\ucrt64\bin to Path variable worked for me.
How do I go about compiling a simple c++ source file using my windows compiler?
I'm using ConEmu as a compiler.
Hey,,, It will work for you I believe
Blockquote
- First: open the link: https://www.msys2.org/
- Go to the installation and download the installer .. install the exe file.
- search mingw in windows search(windows start)
- there is an app named--> MSYS2 MinGW {64/32}-bit
- run it as administrator
- Found command shell ---> type: pacman -Syu
- Will ask you for some installation click on Y
- Then again go to the same app MSYS2 MinGW {64/32}-bit and run as admin
- and write--> pacman -Ss gcc (in shell that opend after click)
- after clicking there will be bunch of things and now you have to care about your windows arch.. if it is 64 bit then write---> pacman -S mingw-w64-x86_64-gcc (and if its 32 you will find something like that where 64 will replaced by 32 in bunch of commands that are showing in your shell)
- after executing this command gcc will be installed in your system to check write: gcc --version || g++ --version
- After that to install the debugger write pacman -S mingw-w64-x86_64-gdb
- to check write: gdb --version
**Every thing got installed in your system now find the mingW file or mysys2 file on C drive(whereever you r mingW file got saved) go the the minGW 64 || 32 accroding to your operating system there is a bin folder click on that and copy the path inside the bin folder and save it in environment variables path **
Blockquote
Enjoy vs code
Works perfect in Visual Code. You need the following:
- C/C++ extension in Visual Code.
- msys64 installed in C:\
- Add path to msys64 bin folder in environment variable
Instructions:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
Important the msys64 path doesn't contain spaces so don't install it in Program Files.
You can search "Edit system environment variables" from the windows button, press button Environment Variables, and then add it as a System variable "Path". For me its located in
C:\msys64\mingw64\bin
[ANSWERED]
Im trying to run C on sublime text3
I've add the folder to gcc.exe to PATH
- Right-click "My Computer"/"This PC" from Windows explorer and pick properties. Alternatively Windows key + X and click "System". An "About" window appears.
- Scroll down to "Advanced system settings" and click on it.
- Click on the "Environment Variables" button.
- Select "Path" in the window that appears and click the edit button.
- Click on "Edit text" (not on "Edit"!).
- Before modifying anything, I strongly recommend to copy the text there and save it in a text file for backup, so that you can restore the
PATHin case of mistakes. - Write a semicolon
;at the end of the text there unless already present. Then after the semicolon add the full path to your Mingw installation'sbinfolder. For example;c:\mingw_w64\bin. - Important: if you installed Mingw under for example
C:\program files\mingw_w64, then the path must be;C:\Program Files\mingw-w64\bin;without any surrounding" ... ". If using the "Edit" command available in this window, then the" ... "will get added and this may break the gcc path from working. (It just happened to me and that's the reason why I decided to write this Q&A.) - Click OK for each open window.
- Reboot Windows.
Now you should be able to type gcc from the command line or use it from your programming IDE.
Alternatively, for CLI users:
- Open
cmd. - Type
PATH. - Add the absolute path to the
binfolder to it. - Place a semi-colon at the end.
- Press enter.
- Reboot.
And you're done.
Edit: For the full path to the bin folder:
cdyour way toMingwinstallation'sbinfolder, or alternatively, presswindows key + e.- Open
mingw->bin. - Copy the full path present in the search bar.
As @Lundin said, you should first make a copy of the original PATH and save it, just in case something goes wrong.
i watched a couple of youtube videos and even added C:\MinGW\bin to the path but still getting the message i mentioned in the title when i write g++ --version in command prompt
can you help me fixing that
I have been running my script on sublime text and I got the error message "'gcc' is not recognized as an internal or external command, operable program or batch file."
I tried running the same script on visual studio code and it worked fine. What is happening here?