Running C and gcc in Windows (XP)

Posted on July 21, 2009 at 23:25 C

If you’ve been conditioned that coding and running C codes in Windows is nearly impossible, think again. It’s actually as easy as X-Y-Z (c’mon people, A-B-C is so yesterday).

  1. Download Dev-C++
  2. Install the software
  3. Go to File > New and do your thing
  4. Execute > Compile (Ctrl+F9)
  5. Execute > Run (Ctrl+F10)

If you’re familiar with gcc and is more comfortable using it, then follow the steps below:

  1. Locate your Dev-C++ installation directory
  2. Go to System Properties (via Control Panel or by right-clicking My Computer) and jump to the Advanced tab
  3. Click on Environment Variables
  4. Locate the Path variable and click Edit
  5. Put a semicolon (separator) at the end of the Variable value
  6. Add [Dev-C++ directory]/bin
  7. Finish with an OK

You can now go to the Command Prompt to execute your C codes. In order to do so, you must be in the directory (folder) where your file is saved.

>gcc -o executable.o filename.c
>./executable.o

AN: Although Dev-C++ offers convenience in compiling and running, it apparently immediately closes the Command Prompt window after running the code without you getting the chance to see the output. In such case, you’ll have to add a system(“pause”); at the end of your code.

Say What?

Name:
E-mail:
Website: (optional)