Undefined reference to '...' error under gcc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaycse
    New Member
    • Jun 2010
    • 1

    #1

    Undefined reference to '...' error under gcc

    I am facing the problem of calling cfitsio library from C program in linux. when i am giving compiling my C program using options
    "gcc -o CreateLevel1Dat aFitsFile CreateLevel1Dat aFitsFile.c -lm -lcfitsio
    "
    i am getting following error

    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(ge tcolj.o)(.text+ 0x7065):/backup/Astrosat/learning/cfits/cfitsio/getcolj.c:3098: more undefined references to `__xtoll' follow
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(ge tcolk.o)(.text+ 0x1bdd): In function `ffgclk':
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(pu tcolk.o)(.text+ 0x22ce): In function `ffintfi8':
    /backup/Astrosat/learning/cfits/cfitsio/putcolk.c:903: undefined reference to `__xtoll'
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(pu tcolk.o)(.text+ 0x22f5):/backup/Astrosat/learning/cfits/cfitsio/putcolk.c:905: undefined reference to `__xtoll'
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(pu tcoluk.o)(.text +0x18a3): In function `ffpcnuk':
    /backup/Astrosat/learning/cfits/cfitsio/eval.y:2856: undefined reference to `__xtol'
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(ev al_y.o)(.text+0 xf801):/backup/Astrosat/learning/cfits/cfitsio/eval.y:2971: undefined reference to `__xtol'
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(ev al_y.o)(.text+0 xfbe9): In function `Do_BinOp_dbl':
    /backup/Astrosat/learning/cfits/cfitsio/eval.y:3028: undefined reference to `__xtol'
    /usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(ev al_y.o)(.text+0 x1023d):/backup/Astrosat/learning/cfits/cfitsio/eval.y:3140: more undefined references to `__xtol' follow
    collect2: ld returned 1 exit status
    Reply With Quote
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    The function _xtoll (or xtoll?) is not in any library or object file you have linked with so the linker can no resolve the reference to it that exists in the code in libcfitsio.a

    Are you missing a library you should be using? or are you missing an object or source file you should be using?

    Comment

    Working...