www.Hilands.com :: Computer Information Dump

Content:: code - c

C / C++

Compiler -
When dealing with a Compiled Language such as C or C++ the first thing we need to do is obtain a compiler. Most linux systems have these compilers built into the base packaged operating system.
Running from a debian net install we can use the apt to grab the compilers we want.
# apt-get install gcc
# apt-get install g++
# apt-get install make
On a windows system we can get a free port of the Gnu Compiler Collection (GCC) called MinGW from http://www.mingw.org/. For ease of installation we will download the MinGW-5.1.4.exe installation file. You'll be able to find it in the downloads section from the MinGW site under "Automated MinGW Installer\<Version>.
Under the installation options I'd recommend adding the "g++ compiler" I also add the GNU Make Installer.
You may notice during the setup the installation program will go out and download some tarball files that have been gzip for the installation. The install file we downloaded is an installation tool that installs mingw from the internet.

MinGW in the Windows Path -
We will be using the MinGW compiler via command line, to simplify our lives I recommend setting C:\MinGW\bin to the PATH Environmental Variable in windows.

The Environmental Variables are stored in the System Properties. Right click on My Computer and select Properties from the context menu.
In the System Properties window select the Advanced Tab and click on the Environment Variables button.
In the Environment Variables window go to the "System variables" section select the Path Variable and click the Edit button.
We should now be in the "Edit System Variable" window. You should see "Path" in the Variable name text field. At the end of the Variable value text field add C:\mingw\bin. Notice the path deliminator is a semicolon (;), be sure there is one before your new path entry.

Compiling Software -
With the path set we can now use the mingw32-gcc.exe and mingw32-g++.exe anywhere we want.
# mingw32-gcc <input filename> -o <output filename>
# mingw32-gcc project.c -o project.exe

Resources -
http://www.mingw.org/
http://cimg.sourceforge.net/
http://www.imagemagick.org/script/index.php
w3c xhtml 1.0 validation   w3c css validation

Resume Link to a pdf fileLink to a new window :: Donate