Compiling and Porting Serial Applications for Windows

2.1 Command Line

Most compilers expect that certain environment variables are set before they are invoked, so setup scripts are provided by the vendors. They are available under more descriptive names in H:\CTC Tools. Also listed in the table are the commands that invoke the compilers.

What to type at the prompt:

Vendor Setup CTC Setup Compile
MS Visual C/C++

vcvars32

setup_visualC

cl

Intel C/C++

iclvars

setup_intelc32
setup_intelc64

icl

Intel Fortran

ifortvars

setup_intelf32
setup_intelf64

ifort


Note: For compiling applications that will run on Itanium machines, the Intel compilers have versions of the setup scripts and compilers whose names are the same as their IA32 counterparts. They are distinguished only be being in different subdirectories. Thus, iclvars.bat in C:\Program Files\Intel\CPP\compiler80\Itanium\bin sets up the user's environment for compiling and linking C/C++ files into Itanium programs (IA64), while iclvars.bat in C:\Program Files\Intel\CPP\compiler80\IA32\bin sets up the user's environment for compiling and linking C/C++ files into IA32 programs.

Once the setup script has been run, programs may be compiled directly from the command line. If one has a simple "hello" program one may type:


>  icl hello.c
or
>  ifort hello.f

and an executable named "hello.exe" will be produced.

In principle any program can be compiled from the command line, but for more complex programs a makefile is very convenient, if not essential. Makefiles and the command-line interface can also be quite helpful when Unix compatibility is an issue. For more information, see the module on Unix-like Interface.