C development environment with gcc vim and radare2 in Windows 10 the easy way

Someone with job duties that range from server administration to network analysis to payload analysis frequently finds themselves writing small scripts ranging from simple text search/replace to deobfuscaters and log parsers. I do this using multiple languages including C, Java, Python among others. I frequently install different compilers and interpreters on different versions of systems. Its beneficial to me to keep these installs lightweight and fast. Here is a simple fast setup that anyone can do of a C and Cpp compiler setup with GCC, VIM editor, Radare2 debugger all running in the windows command prompt.

I did this in a Virtualbox 64 bit Windows 10 guest with 4GB memory on an older i7 PC host with 8GB DDR3. So not exactly a fast PC. This article here Virtualbox Win 10 guest explains how to set that up.

So lets start.

On a Windows 10 box, download CodeBlocks with Mingw:

Download VIM:

Download Radare2:

Run the installers and keep all the default install settings:

Radare2 just installs by dropping to a folder including all its executables and main dependencies. It also requires a microsoft 2015 vcdist dll that we will install in the next step:

So go to Microsoft and download and install the vc_redist.x64 installer:

Next we need to start adding all these executable file locations to our environment variables path. So lets open file explorer:

Navigate to the Codeblocks MinGW gcc compiler executable. It is usually located at:
C:\Program Files (x86)\CodeBlocks\MingGW\Bin
Left click the folder location bar, then right click it and copy the address:

Now in file explorer right click "This PC". Then click "Properties":

Click "Advanced system settings" and then "Environment Variables":

As the next image shows, make sure you select the right "Path" variable under the "System Variables" section then click "Edit" at the bottom:

Click "New" then paste the gcc executable folder location as a new path in the "Edit environment variables" list section as shown in the next image:

We need to repeat that series of steps for the VIM and Radare2 executable folder locations. The images below show the process in detail:

Now reboot Windows 10. After rebooting open a command prompt and type in VIM:

There you have it. VIM at the windows command line with all the basic functionality including search and replace, syntax highlighting, etc etc:

So now that your in VIM, write some simple C code so we can try to compile it with gcc at the windows command line.  When your done writing the code in VIM, press escape then type ":w filename" to save the file to your current directory:

Exit vim by pressing escape then ":q".  Now back at the windows command line type "dir" to see the file you saved in VIM:

Compile that file with gcc:

In the same folder type "dir" again and see what output you received from gcc. I have an old habit to always pass "--save-temps" to gcc so not only do I usually get an error message I get to look in the intermediate files to see where compilation stopped. We are also going to disassemble the executable with Radare2 so i like to see the assembly gcc gave me:

So here is my simple matrix program run and it works just fine. Just fyi this is a quick write simple test program, it has an infinite loop in it if you give it the wrong input so you can just type hello world if you like:

Now lets run Radare2 at the windows command prompt and see if it works:

Radare2 works and here is my disassembly:

One more thing lets run rabin2 from the command line and see what strings i have in my matrix binary:

Great that was fun. Lightweight simple way to write C and Cpp apps from the windows command line with my favorite fast tools. By the way, if you didn't notice we installed the popular CodeBlocks IDE with its gcc compiler so you don't have to use VIM if you like.

Thank you for reading!!! I hope you found something useful here!!!