C/C++ Resources

Glotzilla is written primarily in C/C++. Extending the Glotzilla framework requires a working knowledge of C++, although most modifications can be made by novice programmers. Here we list some useful resources for C/C++ programming.

Linking

To use the Glotzilla libraries together with your code, you must link the libraries to your executable. This is done automatically by the glotzcc command. To link C code in general, you must be familiar with the following three compiler flags:

  • -I - Header file search path (note that -I is a capital 'i')
  • -L - Library search path
  • -l - libary name to link with

Here is an example using these flags

gcc -I/usr/local/include -L/usr/local/lib -lmpi

The -I flag tells gcc to look for header (.h) files in the /usr/local/include folder. If you specify a file to include using brackets in your C code, the compiler will look for the file in the /usr/local/include folder.

#include <mpi.h> //lives in /usr/local/include

The -L flag tells the compiler to look for libarary files (.a, .dylib, .so, etc.) in the /usr/local/lib folder. The -l flag tells the compiler which library to link with. Here, we tell the compiler to link with the "mpi" library. This implies that a file named libmpi.a lives in the /usr/local/lib folder. Note that we leave out the redundant "lib" and ".a" when we specify libmpi.a with the -l flag.