Prev: cint.html Up Next: tools.html
Compiling and linking with blop

Practical Guide:
# compile test.C
g++ `blop-config --cflags` -c -o test.o test.C

# link test.o
g++ -o test test.o `blop-config --libs`

One way of using blop is to write a C++ script and run blop as an interpreter on this file. This is the recommended way to make small tasks, process and plot datafiles, etc. However, you might want to make some heavy data analysis with a compiled C++ program, and create plots within this program. No problem, you can use blop's classes and functions in your compiled software easily:

There is a script called blop-config which can be used to obtain the flags to be given to the C++ compiler (such as libraries, location of include files, etc). Using this script instead of hard-coding these locations in your Makefile can make your software independent from the actual installation location of blop, and therefore it will be easy to port it to other machines, where blop might be installed at some other directories.

It accepts the following command line arguments:

--cflags
Prints the flags to be given to the c++ compiler
--libs
Prints the flags specifying the blop libraries (to be given to the linker).
--cint
If this argument is also given, then the cflags and libs will include also those flags, which are necessary for interpreter support (that is, you can use CINT's features, and you can interpret C++ statements in your program). Your program will be linked with CINT libraries. Refer to the CINT manual in this question.
-n | --namespace
The flags printed for the compiler will include such a flag, which will cause a statement
using namespace blop;
in the blop.h header file, putting all functions/classes of blop into the global namespace

If you want to make the --cint and -n options the default for blop-config, create a file $HOME/.blop/blop-configrc, and include these lines (they must follow bash syntax):

CINT=true
NAMESPACE=true

If you encounter problems, such as some classes of blop are reported as unknown by your compiler, the reason is most probably that not all the necessary files are included in 'blop.h'. This is not your fault, but mine. Please drop me a mail, and if you have no time to wait for the correction, search the blop header files (in the default installation scheme located in /usr/local/blop/) to find, which one contains the classes you are missing, and add these files to blop.h (by default located at /usr/local/blop/blop.h, with /usr/local/include/blop.h being a symlink to this file).


Prev: cint.html Up Next: tools.html