ALPS Home Libraries License Support People ALPS Web Site

PrevUpHomeNext

Compiling User Applications

In order to develop and compile user applications on top of the ALPS libraries, user programs must include ALPS headers and be linked with ALPS libraries. ALPS header files are installed under PREFIX/include, where PREFIX is the path specified by the option to the configure script (see Configure Options). ALPS libraries are installed under PREFIX/lib. For example, you can compile and link your program as

CC -I${HOME}/ALPS/include -L${HOME}/ALPS/lib -o myprog myprog.C -lalps -lm

For parallel applications appropriate linker flags for MPI should be appended (e.g. -lmpi). You should link the ALPS libraries exactly in this order. Otherwise you will have an error message from the linker.

Note that during the ALPS setup and installation, a script file named include.mk is also prepared and installed, in which useful macros for make (such as $(CPPFLAGS) and $(LIBS)) are predefined. By using this file, which is installed as PREFIX/share/alps/include.mk, you can write a simple makefile for your application, e.g.

include $(HOME)/ALPS/share/alps/include.mk
myprog : myprog.C
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o myprog myprog.C $(LDFLAGS) $(LIBS)
Copyright © 2002-2005 Synge Todo, Matthias Troyer

PrevUpHomeNext