Skip to content

GCC Compiler – How to install the GCC Compiler on Windows 7 and create a Buffer Overflow – The Visual Guide


The GCC Compiler runs on Windows 7, this is how to install it.

Step 1 – Download GCC Compiler

GCC download

gcc installer

Step 2 – Run Installer

Right click the install.exe and “Run as Administrator”

gcc installer

NEXTgcc 1

Select 32 or 64 bit Architecture (defaults is 32 bit)


installer 2Next

Allow some time to download > Next

installer 3

installer finish

That’s it – GCC is now installed.


Step 3 – Download Notepad++

Download it here:

Save your programs as *filename.c

(.c is for c programs).


Step 4 – Write a Buffer Overflow in Notepad++

Copy this program into Notepad++ to test out your GCC compiler.


When you run the buffer.c program – it will crash.


Code – for buffer overflow

#include <stdio.h>

int main (int argc, char* argv[]) //start of main
char smallbuff[8]; //8 chars in buffer
strcpy(smallbuff, argv[1]);
printf(“%s\n”, smallbuff);
return 0;
}//end of main


Step 5 – Launch the GCC Compiler

Start > All Programs

MinGw > x64-4.8.1 > Run Terminal

I created c: test directory to store all notepad programs. Note c:\test\buffer.c


cd c:\test (to get to our test directory)

Now we compile and generate buffer.exe – which we run.

gcc buffer.c -o buffer.exe



gcc buffer

Don’t forget buffer.exe to run your program.

Did the program crash?


  1. Kuman Kothiya permalink

    Thnx for the blog, really helpful.


    • Hi Kuman,

      Thanks for commenting. It’s always nice to hear that the blog is appreciated. Take care.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: