# Problems with TFITSHDU

**URL:** <https://root-forum.cern.ch/t/problems-with-tfitshdu/14984>\
**Category:** ROOT\
**Created:** [September 25, 2012, 11:20pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984 "2012-09-25T23:20:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessiezj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jessiezj](https://root-forum.cern.ch/u/jessiezj)\
**Post date:** [September 25, 2012, 11:20pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/1 "2012-09-25T23:20:30Z")

</div>

I wrote a code to read .fits files. I want to compile it.  
I include the TFITS.h file.

and compile it

g++ fits\_time.cxx `root-config --libs --cflags` -o readfits

Then it has the error:  
fits\_time.cxx: In function ‘int main(int, char\*\*)’:  
fits\_time.cxx:38: warning: converting to ‘int’ from ‘double’  
fits\_time.cxx:39: warning: converting to ‘int’ from ‘double’  
/tmp/ccb834Li.o: In function `main': fits_time.cxx:(.text+0x164): undefined reference to`TFITSHDU::TFITSHDU(char const\*)’  
fits\_time.cxx:(.text+0x1e9): undefined reference to `TFITSHDU::GetArrayColumn(unsigned int)’

How to solve this “undefined reference” ?  
[fits\_time.cxx](https://root-forum.cern.ch/uploads/default/original/2X/6/612ba4253a69fb764e316047233df3032827bcdc.cxx) (1.38 KB)

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [September 26, 2012, 12:51pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/2 "2012-09-26T12:51:19Z")

</div>

Hi,

You have to link with libFITSIO. Simply add -lFITSIO to the list of libraries: root-config --libs -lFITSIO

Cheers, Bertrand.

---

<div class="post-metadata">

**Author:** ![jessiezj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jessiezj](https://root-forum.cern.ch/u/jessiezj)\
**Post date:** [September 26, 2012, 3:21pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/3 "2012-09-26T15:21:00Z")

</div>

I tried this compile command  
g++ fits\_time.cxx `root-config --libs -IFITSIO` -o readfits  
But it became even more errors:  
"  
Unknown argument “-IFITSIO”!  
Usage: root-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–auxcflags] [–ldflags] [–new] [–nonew] [–libs] [–glibs] [–evelibs] [–bindir] [–libdir] [–incdir] [–etcdir] [–noauxcflags] [–noauxlibs] [–noldflags] [–has-] [–arch] [–platform] [–dicttype] [–config] [–features] [–svn-revision] [–python-version] [–cc] [–cxx] [–f77] [–ld] [–help]  
fits\_time.cxx:11:19: error: TFile.h: No such file or directory  
fits\_time.cxx:12:19: error: TTree.h: No such file or directory  
fits\_time.cxx:13:22: error: TProfile.h: No such file or directory  
fits\_time.cxx:14:21: error: TCanvas.h: No such file or directory  
fits\_time.cxx:15:21: error: TString.h: No such file or directory  
…

"

What is going on?

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [September 26, 2012, 3:22pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/4 "2012-09-26T15:22:50Z")

</div>

`root-config --cxx --cflags` -o readfits fits\_time.cxx `root-config --libs` -lFITSIO

---

<div class="post-metadata">

**Author:** ![jessiezj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jessiezj](https://root-forum.cern.ch/u/jessiezj)\
**Post date:** [September 26, 2012, 3:32pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/5 "2012-09-26T15:32:54Z")

</div>

Now I tried this command to compile,  
g++ fits\_time.cxx `root-config --libs --cflags` -o fits\_time ~/ProgramFiles/root-v5-32-00/lib/libFITSIO.so  
There is no error when compiling. But when I run the program, there is this error:

Illegal instruction: 4

How to solve this?

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [September 26, 2012, 3:56pm UTC](https://root-forum.cern.ch/t/problems-with-tfitshdu/14984/6 "2012-09-26T15:56:00Z")

</div>

Your “Double\_t Array[4146][2160];” is more than 68MB long -\> see, for example: [url][No error when macro crashes](https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931/2)
