There are some things which I assume you know, and which are outside the scope of this tutorial.
This tutorial discusses code. Almost all of the code discussed is written in C. It is therefore safe to assume that if you don’t have a good working knowledge of C, then you’re likely to get a lot less out of this tutorial as those who do know some C. On the other hand, don’t worry about the more esoteric syntax, I’ll explain this as we need it.
It should also be noted that the code samples in this tutorial are not optimal. They have been written to be as readable as possible, and not necessarily the most efficient possible. Please bear this in mind before blindly copying them.
How to compile and link on your chosen operating system
It is outside the scope of this document to teach you how to compile and link source code into an executable form on your chosen architecture and operating system. You will need to understand this before you will be able to use any of the code in this document.
For those of you using gcc on a Unix (or Unix-like) operating system, then the following points might be all you need to know. If you need more information, then a http://www.google.com search will serve you well.
- Libraries are added to the link command using the -l command line option. For instance, to compile and link the source file foo, with the tiff library, you would use a command line along the lines of
gcc foo.c -o foo -ltiff -lm.
- You need to include -lm almost always. When you compile a c program using gcc without specifying any libraries, you get a -lm for free. As soon as you start specifying any libraries (for instance in this case -ltiff), then you also need to explicitly specify the math library as well.
- You will almost certainly also need to add the library and include paths for the installed version of the relevant library to the compile command line as well. Directories are added to the library search path using the -L command line option. Include directories are added with the -I option.
- The make files included with the samples in this tutorial a probably a bad place to look for introductory compile examples, as they use automake and autoconf to try to detect where the various required libraries are installed…