Installing and Compiling


Jump to: navigation, search

The compiler used was an open source c/c++ compiler mingw. This compiler was chosen first because it is free, and a compiler for this project must be free, as it is then available for everyone, which is especially necessary for compiling training programs. Second, gcc is the best of free c/c++ compilers, as most of the linux is compiled with this compiler. Third, mingw is a natural windows compiler, while cygwin is more like linux in windows; it's better that every operating system remains what it is. It's true that in natural command line mingw we cannot use automake, but not so many libraries are used in this project, and also using only gnu make enables to put libraries as it is more natural in windows, every one in a separate directory. Visual c usually compiles all code which mingw compiles, but not a vice versa. This is because mingw is very strict concerning the standard, but visual c is not, which is bad because this may result in a faulty code, even if compiled correctly.

The version of c is the most classical c, c89, in which most of the linux kernel is written. This version of c is the simplest, in human dimensions, and almost the only one completely implemented by the compilers. The programs written in c are the fastest, faster than these in java, basic, perl, or whatever other programming language. The speed is the most important, and there are no tricks to make programming substantially faster, these rather often make the programming languages much more complicated. Look at for the c89 description, this otherwise says everything which the standard says, except it doesn't include examples, as it otherwise was not a public domain. If you first read it, you most certainly don't understand anything. But every next time you read it, you understand more and more. This is because knowledge is rather like a system, not a tree, and so cannot always be represented so that this comes from that, and from that come other things etc, rather it represents how the things are related. There was a committee draft of c89 stundard once available on the internet, but now it cannot be found any more, and in iso, the standard costs some $100, this is why it is important that the c89 description is publicly available.

Mingw site is at If you don't have mingw, download it at (current, MinGW, MinGW-x.x.x-x.exe). Then just execute the installer. For using mingw, the path to it's bin directory must be in system path. In windows 2000 and xp, the user path can be changed at start->control panel->system->advanced->environment variables. See whether in the first section of the dialog box, titled "user variables", there is a variable called PATH. If there is, press edit, and if there isn't press new. Variable name should be path, and variable value should be paths to be searched, separated by semicolon. Say that you installed mingw in the directory c:\mingw, then you should add c:\mingw\bin to the variable value, preceded by semicolon, if there are some paths already written. Then press ok in all dialog boxes, and the change should take effect immediately, without rebooting the computer. To check whether mingw is installed, click start->run, type cmd, click ok, type gcc and press enter. When the gcc says "no input files", then mingw is ready to work. Download all the necessary gnu documents as well, such as gcc, binutils, make, and glibc. The version of mingw ADS was last compiled with, was MinGW-3.1.0-1.

There are three makefiles, two for compiling dll-s, and one for the main program. build.bat should compile all. Unfortunately there are other programs called redir, if you have such in path, you should add a path to mingw redir, in the bat file. Remember that windows explorer does not change directory in cmd shell. A good solution is to use open source programmer's editor vim ( press i to work as a windows editor), this is often considered the best programmer's editor, you would most certainly not regret installing it. Right-click some text file, like di.c, and choose "edit with vim". Then :!build should build the program. That after you may enter :!cfile make.txt, after that !cnext brings you to the next error, if there are errors. There are other, and maybe better possibilities for compiling using vim, but with this one it's not necessary to change the configuration of the editor.

If you made changes, it's the best to announce them on the project's forum, so that others will know as well. This may even be enough, if the change is small, or a simple bugfix. Otherwise, you may send a diff file (may be an ordinary gnu diff), but, if your contribution is substantial, better become a developer, and commit the changes in cvs yourself. For cvs, use cvsnt at (you may do checkout from c:\ directory, but for everything else make sure that cmd shell is in ADS directory, either by running cvs inside vim editor, or changing directory in cmd shell, windows explorer *does not* change the directory in cmd shell). Remember to write your name, the date, and a description of the change, in Changes.txt file.

Though this program is not so very big, it is very difficult to program. You should use hacking, not debugger, which is including some pieces of code, which write what it does, usually in file. Sometimes it was necessary to even run the analyzer in different parts of the program, to find out where the error starts. But it was always possible to find the bug that way. Certainly install the ram disk, and write the debug messages there, otherwise your hard disk becomes too hot during such debugging. Use a free ar soft ramdisk at Then add a debugging code like this:

#if 1
FILE *test;
test = fopen ("z:\\test.txt", "w");
fprintf (test, "was here");
fclose (test);

A possible settings in _vimrc file (in vim directory):

set nobackup
set fileformats=dos
set guifont=Courier_New:h10:cDEFAULT
set ignorecase
set smartcase
set textwidth=80
set wrap
set tabstop=2

Just that tabstop is 2, and with that the lines don't exceed 80 characters. It's better to have tabstop 2, when there is a lot of hierarchy in the program. as in such programs as ads. Otherwise, just please follow the style there is in the code.

And it would be very useful, if someone would port this program to gtk and linux. The gtk set of libraries, including glib, should be enough to provide all the necessary libraries for ADS, and write a fully portable code.

A file should be split into smaller files when it exceeds 100 kb.

Personal tools