You are on page 1of 4

7/16/2017 How to execute a C program in Notepad++ | CodingFox

1.9 – How to configure gcc in Notepad++ for C11


BY SU BB U ON AUG US T 2 , 2 01 3

Configuring notepad++ to compile and execute C


programs using gcc:
Notepad++ is a free open source editor that supports several languages.
It is popular for its user friendly, higher execution speed and less size. It
is developed for windows environment in C++. It consumes lower
memory and CPU power. It can be used to write, test and execute
programs of different languages. Now we will see how notepad++ can be
configured to compile and execute C programs using gcc.

Step1: Download and install the latest version of notepad++ from its
official website www.notepad-plus-plus.org for free of cost
Step2: Download and install MinGw gcc as explained in the previous
session.
Step3: Configure notepad++ for gcc

Creating C compiler tool in Notepad++

http://codingfox.com/1-9-how-to-configure-gcc-in-notepad-for-c11/ 1/4
7/16/2017 How to execute a C program in Notepad++ | CodingFox

→ Open the notepad++

→ Select Run – Run (F5)

→ Type the following compiler script in “The program to Run” panel

gcc -o "$(NAME_PART)" "$(FULL_CURRENT_PATH)"

gcc is to call compiler


-o is to create executable file with the file name
“$(NAME_PART)” to specify the file name without extension
“$(FULL_CURRENT_PATH)” to specify the current file and its path

For example if we save the file with “hello.c“, then the run command
replaces compiler script with gcc -o hello c:\…\…\…\hello.c

→ Select save to create short-cut to compiler tool (ctrl+f9)

http://codingfox.com/1-9-how-to-configure-gcc-in-notepad-for-c11/ 2/4
7/16/2017 How to execute a C program in Notepad++ | CodingFox

Create the C execution tool:


→ Select Run – Run (F5)
→ Type the C program execution script in “The program to Run” panel

"$(NAME_PART)"

Here “$(NAME_PART)” is to specify the file name without extension to call


the executable file.
For example if we save the file with “hello.c” then the execution tool
replaces the execution tool script with hello

→ Select save to create short-cut to execution tool (ctrl+f5)

http://codingfox.com/1-9-how-to-configure-gcc-in-notepad-for-c11/ 3/4
7/16/2017 How to execute a C program in Notepad++ | CodingFox

Executing a C program in Notepad++:


Type the program

1 #include<stdio.h>
2 int main()
3 {
4 printf("Hello World");
5 return 0;
6 }

Use Ctrl + F9 to compile the program

Use Ctrl + F5 to execute the program

http://codingfox.com/1-9-how-to-configure-gcc-in-notepad-for-c11/ 4/4

You might also like