Public domain C compilers
I use two compilers, both are 32-bit compilers.
-
gcc (C/C++) with IDE called rhide (DJGPP), this is DOS Turbo C style IDE
that works with Windows98
-
lcc-win32, (C only) this is windows API style, it works with both Windows98
and Windows2000
DJGPP
Installing
Using
LCC-WIN32
Installing
Using
I have used DJGPP extensively and it works well. I have just started
to use lcc-win32, it works.
DJGPP
DJGPP is a front-end for C/C++ compiler (gcc). The site http://www.delorie.com/djgpp/
contains full sources and FAQ and many other information.
Installing
To install DJGPP, download this package,
(10 M) and unzipped it. (to your path, say c:\djgpp)
Add this two lines to autoexec.bat
set DJGPP=C:\DJGPP\DJGPP.ENV
set PATH=C:\DJGPP\BIN;%PATH%
I have unpacked and installed (just unzipped many files) and then repacked
the whole directory into one package. I didn't include ALL utilities
(such as graphics). If you want a more complete utilities, please
refer to the DJGPP site. I do have some problems on debugging tools
like single stepping and setting values of variables (there are many options).
However, for a simple programming task (such as studying a simulator for
Computer Architecture), it is sufficient.
The only complain I have toward DJGPP is that it doesn't run under Windows2000
which is the platform I use daily. This is the reason why I search
for other tools and found lcc-win32. The good point about DJGPP is
that its front-end is easy to use. It is much easier than Visual
Studio and much less complex, so simple project can be done is much less
time. I also like the DOS style font in the IDE. The back end
compiler is gcc (www.gnu.org) which is
a very high quality compiler. GCC has a long history and its development
is still very active. It is very reliable. I have used gcc
during my PhD year (around 1987 !). The department used it because
it is free and the quality is comparable to the proprietry compiler at
that time.
Using DJGPP
Because DJGPP is a DOS style application (it is developed from the DOS
era), it is started from the DOS prompt. You have to set the path
properly by including a script into autoexec.bat file (which is executed
when the OS boot). DJGPP outputs to the directory where it is started
from therefore you should start it from the DOS prompt in your source directory.
(I made an icon for it and found that it outputs everything to the root
directory !).
If you are familiar with Turbo C style interface, then you are almost
at home. You can compile without making a project, just start a new
file and then "Make" or "Build all". You can set many options for
the editor such as the number of lines, tab size. The most basic
option for the compiler is -g (for retaining the symbolic name).
Using debugger is a bit more involved, it is easier just to "printf" any
value you want to see. (but this is so primitive).
To use DJGPP, you MUST open a console (dos prompt) and change to your
source directory and start it from there, running "rhide".
LCC-WIN32
lcc-win32 is a front-end that integrates a C compiler, lcc. lcc is
a ANSI-C compiler written by two researchers from Bell lab and Princeton
university. lcc is small and fast (small means it source is only
11,000 lines, as opposed to gcc 32,000 lines). It is described in a text
book "A retargetable C compiler: design and implementation" C. Fraser and
D. Hanson, Benjamin/Cummings Pub., 1995. lcc website is http://www.cs.princeton.edu/software/lcc/
Installing
To install lcc-win32, download this package, (5 M)
unzip it and install it (click on lccwin32.exe and then lccdoc.exe).
lcc-win32 will feel like other Windows application. It comes with
Icon you can click.
The lcc-win32 http://www.cs.virginia.edu/~lcc-win32/
packages a rather full Windows development tools (such as Windows API)
with lcc. As a Windows development it is necessarily complex.
The interface feels like Visual Studio. I have include only two most
basic options in my package: lcc-win32.exe (the compiler system)
and lccdoc.exe (user manual and technical documentation). For other
documents (such as Windows API) please refer to the lcc-win32 site.
Using lcc-win32
Initially you must create a "project". The easiest is the type "console
application". Wedit will generate a "template" program for you which
you can add your routines. Because it is a Windows application, it
behaves as you would expect from Windows, resizing, multiple windows etc.
(I don't like the font in the editor). You have to create a project
in order to get it to compile your programs. Do "Project", "Create"
and select the most simple type "console application", include your files
into the project then "build". You can run your program from the
command line. (mine still outputs a mysterious error when it ends,
but it works correctly).