Windows C Toolchain Easy Setup (Mingw + Notepad)

Posted by: Chao Category: code Comments: 0

Windows C Toolchain Easy Setup (Mingw + Notepad)

Install mingw +GCC on windows, find mingw installer on google:

https://sourceforge.net/projects/mingw/

Install mingw base and gcc in installer:

Setup environment path:

in control panel – system and safe – system – advanced system setup – environment setup and find path

Check if the path is working correctly:

enter into console CMD: gcc -v

Install notepad, recommanded version is 7.56, which has better support for plugins. Start to test simple hello print code:

#include <stdio.h>

int main() {
	int i = 10;
	printf("i=%d\n", i);
	printf("Hello 111\n");
}

Use notepad “run” function from the menu, enter following command for compiling:

cmd /k gcc -o “$(CURRENT_DIRECTORY)\$(NAME_PART).exe” “$(FULL_CURRENT_PATH)” & pause & exit

This will compile the current c file in notepad into windows executable file .exe, same name in the same folder.

And run command to run this exe file:

cmd /k “$(CURRENT_DIRECTORY)\$(NAME_PART).exe”

These two commands can be saved in notepad menu “run”:

C compiler GCC in windows can help you to quick start with c code learing, also try many preincluded functions like:

  • memcpy()
  • getkey()
  • printf()

These functions are pre-included in the string or stdio headers:

#include <stdio.h>
#include <string.h>

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: