run / index   Raw
1.0/ 1 week ago

run

run is a C interpreter for Windows – or more accurately, it is a compiler and cacher of C programs. When given the file example.c, run compiles and executes it. The resulting executable, example.exe, is stored in the same directory, but as a hidden file. Now, any subsequent time example.c is run, it is re-compiled only if it has been modified since the last compilation.

Installation

First of all, make sure you have all the prerequisites in place. Put run.exe and rungui.exe somewhere in your PATH. To run C files from the command prompt, issue the following command:

C:\> run filename.c [arguments ...]

To run C files from Explorer, set rungui.exe as the default program for .c files, or use the Open With menu to select rungui.exe.

Prerequisites

run does not include a C compiler nor any standard library. You must install these manually and add their paths to the relevant environment libraries:

  • (Required) C compiler and linker named cl placed somewhere in your PATH
  • (Optional) C header files placed somewhere in INCLUDE
  • (Optional) C libraries placed somewhere in LIB

If you wish to use run with Visual Studio (C++) and/or the Windows SDK, you can define the VSDIR and/or SDKDIR environment variables, and run will automatically set INCLUDE, LIB and PATH to the correct values:

If you define…
Then run will set…
VSDIR
INCLUDE = VSDIR\vc\include
LIB = VSDIR\vc\lib
PATH = VSDIR\vc\bin;
VSDIR\Common7\IDE
SDKDIR
INCLUDE = SDKDIR\include
LIB = SDKDIR\lib

Tips

  1. To create or modify an environment variable, run sysdm.cpl (or right-click on My Computer), select the Advanced tab and click on Environment Variables.
  2. Visual C++ Express Edition and the Windows SDK are both freely available for download online. I personally use Visual C++ 2010 and the Windows Server 2003 SP1 Platform SDK.
  3. To use a non-Microsoft compiler with run, such as gcc, just make a copy of it named cl.exe and put its location in your PATH variable.