Installing with MinGW is probably the easiest option. In the MinGW installation manager, under "basic setup", you'll want to check "mingw-gcc-g++", then hit Installation -> apply changes.
You should then see the gcc binaries in C:/MinGW/bin.
To be able to run gcc from the command line from anywhere, you will need to add C:/MinGW/bin to your PATH. To do that:
- Windows+X -> System
- Search for "Environment variables"
- "Edit System Environment Variables"
- "Advanced" Tab
- "Environment Variables..."
- Find Path in the System variable list and hit Edit
- Add C:/MinGW/bin, if it isn't already
Then you can open a terminal window in the folder where your code is and write
gcc -o output.exe source.c
And compile it.
I struggled with this when i first got introduced to c, because everyone acted like it was common sense.
I can give you a basic run down, but not a full walk through. you need to download some version of gcc like from the link you shared if it is safe. Once you have it downloaded and installed you’re gonna need a text editor of some sort. I personally use notepad++, but every programmer swears that some text editors are better than others. Once you have a text editor downloaded when you make a new text in the editor you should save the project somewhere, but when you open up the save as section there will be .C files and probably some others you can save it as, so you would save it as a .C
If you look up Derek Banas on youtube he does some great tutorials in c and how to install everything.
Infinity I'm not too sure about this, but from GCC page we have 3 choices for installing under Windows, Cygwin, MinGW and mingw-w64. The MinGW Downloads link lead to this site, there is an exe file mingw-get-setup.exe. The description says:
mingw-get is a tool to assist users in the management of MinGW and MSYS
Its easy to install GCC on your windows machine.
Just download TDM Gcc compiler
here is a link to it.
Once you install it you are good to go.
Make your C program and save it as .C extension.
Then open Command prompt by typing cmd on keyboard.
Suppose you have created hello.C as your file name in Documents folder.Then
do the following steps.
Your cmd prompt will first have default location set as
then change its directory by typing "cd you c file location"
like this- cd documents
then its path will change.
gcc -o hello hello.c
This will compile the file successfully if it doesnot contain any error.
Then it will create an executable file hello.exe in your documents folder,then
type hello and press enter and you will able to run your code.
oh btw once you create some teat code and need to run it you will need to open up your command prompt and navigate to the folder which you have the code stored and run the code (google how). When it runs it’ll create an executable named “a” and you will run that executable using ./a and it will execute your code
Hi Infinity, sorry for replying late.
I'm not familiar with this issue but a quick google search said that you can either:
- Try running the command prompt as an administrator
- Set the TEMP and TMP environment variables (in the same window you changed PATH) to some folder you know you can write to. People on several forums created a folder "C:\tmp" and pointed TEMP and TMP there. It's a temp folder so it's just stuff that gcc needs while its compiling and it is useless afterwards.
Under Windows XP / Vista / 7 / 8.x / 10 section, click the link with mingw-setup(highlighted row) either from Sourceforge.net or FossHub.
Open the Code::Blocks Setup file and follow the instructions (Next > I agree > Next > Install); you don’t need to change anything. This installs the Code::Blocks with gnu gcc compiler, which is the best compiler to start with for beginners.Now, open Code::Blocks and go to File > New > Empty file (Shortcut: Ctrl + Shift + N)
Write the C code and save the file with .c extension. To save the file, go to File > Save (Shortcut: Ctrl + S).
Important: The filename should end with a .cextension, like: hello.c, your-program-name.c
To run the program, go to Build > Build and Run(Shortcut: F9). This will build the executable file and run it.
If your program doesn’t run and if you see error message "can't find compiler executable in your search path(GNU GCC compiler)", go to Settings > Compiler > Toolchain executables and click Auto-detect. This should solve the issue in most cases.