-
Notifications
You must be signed in to change notification settings - Fork 0
02_3 windows setup
Windows is not the most friendly operating system for C programming. Microsoft offers support for C++, with the Visual Studio IDE. However, the support for new C standards is lacking.
A better alternative is to use MinGW, which is detailed below. It's not easy and fast to configure, but if you take your time you will get there.
Yet another approach possible nowadays is to enable the Linux Subsystem in Windows. You open the Bash through the Command Line or Powershell and you are basically inside a Linux system. You can use all commands you know and love from Linux and install the GCC or Clang compilers easily. The system shares files with the Windows host machine, thus you can use a text editor to edit local files in Windows and compile them through the linux subsystem.
- Download the installer here
- Run the installer
- On the first step look at the installation directory. You can customize it but you will need to remember it later on. Click Continue
- The download and installation process will start
- Then you will see MinGW Installation Manager window. On the left side panel, browse through All Packages > MinGW > MinGW Base System > MinGW Compiler Suite. Next, on the right side panel check all the boxes with the description The GNU C Compiler. Finally, on the top bar, click Installation and Apply. Wait until it completes.
- Now you need to configure environment variables. This is optional, but it makes easier to compile programs. You can specify the compiler directory everytime you compile code, which by default is
C:\MinGW\bin\gcc.exe
. However, after this process, you can run the compiler by simply typinggcc
on the console. To edit Windows environment variables, go to System > Advanced System Settings > Environment Variables. A new window will pop up. On the first box, user variables, double-click on Path variable. Next, add a new entry with MinGW installation directory including the bin folder. If you used the default location, the path is C:\MinGW\bin. Close all the windows clicking OK. - Let's test if the configuration was successful. Open the command prompt and type
gcc --version
. You should get an output like below.
Soon...