Menu

undefined reference to class members

2003-01-13
2012-09-26
  • Nobody/Anonymous

    I'm trying to program something using apstring.h and dice.h (which also includes randgen.h).  I placed these and their corresponding .cpp files in my /include directory, but I'm getting the following linker errors:

    c:\my documents\programs\arpg\combat.o(.text+0x4d):combat.cpp: undefined reference to `Dice::Dice(int)'
    c:\my documents\programs\arpg\combat.o(.text+0x5e):combat.cpp: undefined reference to `Dice::Dice(int)'
    c:\my documents\programs\arpg\combat.o(.text+0x6f):combat.cpp: undefined reference to `Dice::Dice(int)'
    c:\my documents\programs\arpg\combat.o(.text+0x84):combat.cpp: undefined reference to `apstring::operator=(char const *)'
    c:\my documents\programs\arpg\combat.o(.text+0x99):combat.cpp: undefined reference to `apstring::operator=(char const *)'
    c:\my documents\programs\arpg\combat.o(.text+0x101):combat.cpp: undefined reference to `operator<<(ostream &, apstring const &)'
    c:\my documents\programs\arpg\combat.o(.text+0x117):combat.cpp: undefined reference to `operator<<(ostream &, apstring const &)'
    c:\my documents\programs\arpg\combat.o(.text+0x159):combat.cpp: undefined reference to `Dice::Roll(void)'
    c:\my documents\programs\arpg\combat.o(.text+0x16d):combat.cpp: undefined reference to `Dice::Roll(void)'
    c:\my documents\programs\arpg\combat.o(.text+0x1bd):combat.cpp: undefined reference to `operator<<(ostream &, apstring const &)'
    c:\my documents\programs\arpg\combat.o(.text+0x1e9):combat.cpp: undefined reference to `operator<<(ostream &, apstring const &)'
    c:\my documents\programs\arpg\combat.o(.text$__10characters+0x1f):combat.cpp: undefined reference to `apstring::apstring(void)'
    c:\my documents\programs\arpg\combat.o(.text$__10characters+0xbf):combat.cpp: undefined reference to `apstring::~apstring(void)'
    c:\my documents\programs\arpg\combat.o(.text$_$_10characters+0x15):combat.cpp: undefined reference to `apstring::~apstring(void)'

    I have absolutely no idea what this implies.  Does anyone know how to fix it?

     
    • Nobody/Anonymous

      Sorry about the double post. I should've realized when IE said that I needed to resend information that it would re-post my topic...

      - Max

       
    • Patrick Ogay

      Patrick Ogay - 2003-01-14

      these are linking errors:
      your module combat, can not linked correctly, because the linker doesn't have/find the module/lib where Dice is coded. 
      Either Lib is missing, or compilation of Dice has failed.
      Patrick

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.