So... can anyone see what I'm doing wrong here?!? I'm trying to read a *.fits
file in C++ using CCfits
following their example at http://heasarc.gsfc.nasa.gov/fitsio/CCfits/html/readimage.html.
#include <iostream>
#include <valarray>
#include <CCfits/CCfits.h>
#include <CCfits/PHDU.h>
namespace fit = CCfits;
int main(int argc, char * argv[]) {
fit::FITS inFile(
"../data/example/example.fits",
fit::Read,
true
);
fit::PHDU & phdu = inFile.pHDU();
std::valarray<unsigned int> fitsImage;
phdu.read(fitsImage);
return 0;
}
I get the following error:
undefined reference to `void CCfits::PHDU::read<unsigned int>(std::valarray<unsigned int>&)'
collect2: error: ld returned 1 exit status
I'm linking with this:
g++ test.cpp -o test -L/usr/lib/x86_64-linux-gnu/ -std=c++11 -lCCfits -lcfitsio
Although I looked at /usr/include/CCfits/PHDU.h
and it has this:
template<typename S>
void read(std::valarray<S>& image);
Is it possible that libCCfits
wasn't compiled right?
(this is somewhat related to CCfits library demo code not working, but since no one really expanded on that... I'm left with nothing). This is driving me crazy, I'm thinking I'm missing something really obvious.
Thanks.