C ++使用ccfits读取适合文件 [英] c++ reading fits file using ccfits

查看:117
本文介绍了C ++使用ccfits读取适合文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以...任何人都可以看到我在这里做错了吗?!我试图按照CCfits在C ++中读取*.fits文件. "nofollow noreferrer"> http://heasarc.gsfc.nasa.gov/fitsio/CCfits/html/readimage.html .

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;
}

我收到以下错误:

undefined reference to `void CCfits::PHDU::read<unsigned int>(std::valarray<unsigned int>&)'
collect2: error: ld returned 1 exit status

我与此链接:

g++ test.cpp -o test -L/usr/lib/x86_64-linux-gnu/ -std=c++11 -lCCfits -lcfitsio

尽管我看着/usr/include/CCfits/PHDU.h,它具有以下特征:

Although I looked at /usr/include/CCfits/PHDU.h and it has this:

template<typename S>
void read(std::valarray<S>& image);

libCCfits是否可能没有正确编译?

Is it possible that libCCfits wasn't compiled right?

(这与 CCfits库演示代码不起作用有关,但由于没有人真正对此进行扩展,因此我一无所有).这让我发疯,我想我缺少真正明显的东西.

(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.

谢谢.

推荐答案

如果没有libCCfits.so,则表明您使用的Linux发行版中存在错误. (我在较旧的Fedora发行版上遇到了与其他库的等效问题.)解决该问题的最简单方法是,将libCCfits.solibCCfits.so.0libCCfits.so.0.0.0的符号链接添加,假定后者存在于..../.libs文件夹中. 另一种方法是通过

If there is no libCCfits.so, this is an error in the Linux distribution you're using. (I have encountered equivalenet problems with other libraries on older Fedora distributions.) The simplest way to fix it is to add a symbolic link from libCCfits.so and libCCfits.so.0 to libCCfits.so.0.0.0, assuming the latter exists in the ..../.libs folder. The alternative is to compile the source package of CCfits-2.4.tar.gz yourself via

tar -xzf CCfits-2.4.tar.gz

cd CCfits

./configure --prefix=.... --with-cfitsio-include=..../cfitsio/cfitsio --enable-static LDFLAGS="-L..../cfitsio/cfitsio"

这些点取决于您的喜好以及基础cfitsio的位置.

where the dots depend on your preferences and on the location of the underlying cfitsio.

这篇关于C ++使用ccfits读取适合文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆