Monday, May 25, 2009

CCfits

CCfits is a wrapper for the cfitsio C routines that are useful for manipulating fits images. I would like to see how useful C++ might be for astro applications, and maybe eventually adopt Python for prototyping code and C++ for writing fast, efficient code.

To install cfitsio and CCfits, I just followed the documentation with the normal configure/make/install steps. The only minor hitch was getting the CCfits ./configure script to point at the right cfitsio library locations.

I had to dust off my C++ books and remember a few things to actually get the gcc/g++ compiler up and running. For gcc/g++, I spent most of my time remembering the header/library system of doing things. Not sure my terminology is kosher here, but you need to point the compiler to the right "include" path (containing function declarations) correctly link to the library (containing the actual definitions). I ended up using something like:

g++ -I/usr/local/include/CCfits -lCCfits cookbook.cpp

to successfully compile and run the CCfits test routine. Without the include path, all kinds of errors involving the std:: namespace were returned, and with the "-lCCfits", the CCfits:: were compiled with numerous errors.

Finally, if you try to run the executable without setting the "LD_LIBRARY_PATH" environmental variable to the location of the shared library, it complains about not finding "lCCfits.so.0" during runtime.