Install C/GCC Compiler for Windows | DigitalOcean (2024)

DigitalOcean
    • Log in to:
    • Community
    • DigitalOcean
    • Sign up for:
    • Community
    • DigitalOcean

Tutorial

Published on August 3, 2022

  • C Programming

Install C/GCC Compiler for Windows | DigitalOcean (1)

Pankaj

Install C/GCC Compiler for Windows | DigitalOcean (2)

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

The first step in learning any programming language is to have the required software installed in the system. In this tutorial, we will learn how to install C/GCC compiler in Windows.

Source Code Editors

Although, you may choose any basic text editor such as notepad for writing and editing source code of C, we recommend choosing one of the editors below.

  1. Notepad++ (Only for Windows)
  2. Microsoft Visual Studio Code (For Windows and Linux)
  3. ATOM (For Windows and Linux)
  4. IDEs (Integrated Development Environment) such as Eclipse or Netbeans may be used but if you are a beginner in C programming, prefer using text editors mentioned above.

Install C/GCC Compiler for Windows

  • One of the preferred way to install C/GCC compiler is to use CodeBlocks. Just install it, launch it and start coding to keep things simple. In other words, CodeBlocks is a free C/C++ IDE that comes with the built-in compiler.
  • Download codeblocks from www.codeblocks.org/downloads/binaries for your respective Operating System.
  • Windows users should choose download file which has “mingw” in its name, for example, codeblocks-17.12mingw-setup.exe.
  • During installation, select Type of Install as “Minimal: Important plugins, important lexers” and make sure “MinGW Compiler Suite” is Checked. This will make sure that GCC compiler is also installed with the IDE.
Install C/GCC Compiler for Windows | DigitalOcean (3)
Install C/GCC Compiler for Windows | DigitalOcean (4)

Setting up PATH Variable for Windows

Once Codeblocks is installed, GCC compiler also gets installed with it. However, if we want to execute C programs from command prompt, we have to add its bin directory to the PATH variable.

  1. Go to installation Directory and copy the path of bin folder, e.g. “C:\Program Files (x86)\CodeBlocks\MinGW\bin
  2. Go to “Control Panel\System and Security\System”, Click “Advance System Settings” and then “Environment Variables”.
Install C/GCC Compiler for Windows | DigitalOcean (5)
  1. Find the Variable Name “Path” in User or System (if you are administrator) Variables and click on Edit.
  • If you see a small popup, In “Variable value” box, go to end of text, put a semicolon “;” and paste the path of bin folder i.e. “C:\Program Files (x86)\CodeBlocks\MinGW\bin”
  • If you see a big popup (usually in windows 10) with the list of Path variables, click on “New” and paste the “bin” folder path.
  1. Press OK on all opened popup windows.
  2. Open cmd and write “gcc” in it, press enter/return key.
    • If you see “gcc: fatal error: no input files compilation terminated.”, it means that GCC is successfully installed and you can exit the cmd.
    • In case you get the message “‘gcc’ is not recognized as an internal or external command”, follow steps correctly for installation and configuration of Path variable.

That’s all for installing C/GCC compiler in Windows. We are ready now to explore coding features of C Programming.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Install C/GCC Compiler for Windows | DigitalOcean (6)

Pankaj

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

JournalDev

DigitalOcean Employee

Install C/GCC Compiler for Windows | DigitalOcean (7)

November 25, 2021

How to download the compiler and set it up on env variables, without downloading built in c compiler in codeblocks?

- Faiq

    JournalDev

    DigitalOcean Employee

    Install C/GCC Compiler for Windows | DigitalOcean (8)

    October 12, 2021

    It has worked sir. Thank you…

    - Kumar

      Try DigitalOcean for free

      Click below to sign up and get $200 of credit to try our products over 60 days!

      Sign up

      Popular Topics

      • Ubuntu
      • Linux Basics
      • JavaScript
      • Python
      • MySQL
      • Docker
      • Kubernetes
      • All tutorials
      • Talk to an expert

      Join the Tech Talk

      Featured on Community

      Install C/GCC Compiler for Windows | DigitalOcean (10)

      Get our biweekly newsletter

      Sign up for Infrastructure as a Newsletter.

      Sign up

      Install C/GCC Compiler for Windows | DigitalOcean (11)

      Hollie's Hub for Good

      Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

      Learn more

      Install C/GCC Compiler for Windows | DigitalOcean (12)

      Become a contributor

      Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

      Learn more

      Featured Tutorials

      Kubernetes CourseLearn Python 3Machine Learning in PythonGetting started with GoIntro to Kubernetes

      DigitalOcean Products

      CloudwaysVirtual MachinesManaged DatabasesManaged KubernetesBlock StorageObject StorageMarketplaceVPCLoad Balancers

      Welcome to the developer cloud

      DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

      Learn more

      © 2024 DigitalOcean, LLC.Sitemap.

      Install C/GCC Compiler for Windows | DigitalOcean (2024)

      References

      Top Articles
      Latest Posts
      Article information

      Author: Merrill Bechtelar CPA

      Last Updated:

      Views: 6379

      Rating: 5 / 5 (70 voted)

      Reviews: 93% of readers found this page helpful

      Author information

      Name: Merrill Bechtelar CPA

      Birthday: 1996-05-19

      Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

      Phone: +5983010455207

      Job: Legacy Representative

      Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

      Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.