Help:Building and running/C

From LiteratePrograms
Jump to: navigation, search

This article contains information on how to build and run C programs on different platforms.

[edit] UNIX like systems (GNU/Linux, *BSD, Solaris etc.)

Many UNIX like systems come with a preinstalled C compiler, which can be started with the command cc filename.c, and the specified C file will be compiled and linked.

If compilation/linking is successfull, an executable file called a.out is generated. To run that file enter ./a.out on the command line.

Some articles on LiteratePrograms contain a file called Makefile. This file has instructions for automatic building. To build a program with a Makefile on a UNIX like system, just enter make. This Wikipedia articles, contains a basic introduction to Makefiles.

Some free compilers for UNIX-like systems include:

[edit] Windows NT/2000/XP

The Windows operating systems do not come with a C compiler, but there are several, both free and proprietary, available:

  • Free
    • Cygwin, a UNIX like environment for Windows, includes GCC
    • Dev-C++, an Integrated Development Environment (IDE), also includes GCC
  • Proprietary
    • Microsoft Visual Studio is an IDE that includes compilers for multiple languages, including C
    • The Borland C++ Builder IDE can compile C programs