Compiler and Linker Flags

Regina comes with a small program called regina-engine-config, which tells you how to compile Regina into your own C++ projects.

When you compile your own C++ code, you will need to pass some extra flags to the compiler. To find these extra compiler flags, run regina-engine-config --cflags.

    example$ regina-engine-config --cflags
    -I/usr/include/regina-normal -I/usr/include -I/usr/include/libxml2
    example$

When you link your code into a final executable, you will also need to pass extra flags to the linker. To find these extra linker flags, run regina-engine-config --libs.

    example$ regina-engine-config --libs
    -L/usr/lib -lregina-engine /usr/lib/libxml2.so /usr/lib/libgmp.so /usr/lib/libgmpxx.so /usr/lib/libz.so -lpthread
    example$

If your code is a single C++ source file, you can compile and link a final executable in one simple step:

    example$ g++ mycode.cc `regina-engine-config --cflags --libs`
    example$

Compiler and linker flags will differ from system to system. You should always use regina-engine-config to find out what they are, and not just copy the flags that appear in the examples above.

Note that these compiler and linker flags are tailored to the GNU C++ compiler (g++). If you use a different compiler, you might need to adjust your flags accordingly.