Note that there are some explanatory texts on larger screens.

plurals
  1. POCryptic compiler error, maybe to do with use of "virtual"?
    primarykey
    data
    text
    <p>I'm getting this compiler error. I have several hundred lines of code, so I'll post some that I think might be relevant but you'll need to tell me what you want to see.</p> <p>Here's the error I get at compile time:</p> <p>/tmp/ccBE5kZ5.o:game.cpp:(.text+0x1067): undefined reference to <code>vtable for Person' /tmp/ccBE5kZ5.o:game.cpp:(.text+0x17a5): undefined reference to</code>vtable for Person' /tmp/ccBE5kZ5.o:game.cpp:(.text+0x1ee6): undefined reference to <code>vtable for Person' /tmp/ccBE5kZ5.o:game.cpp:(.text+0x2560): undefined reference to</code>vtable for Person' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: /tmp/ccBE5kZ5.o: bad reloc address 0xc in section `.text$_ZN6WeaponD1Ev[Weapon::~Weapon()]' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation collect2: ld returned 1 exit status</p> <p>Here's the declaration of my Person class and my Weapon class, and the Actor class the Person is a descendant of:</p> <pre><code>class Actor { public: virtual void act(); virtual string getName(); virtual void setName(string n); Actor(); Actor(string n); virtual ~Actor(); private: string name; }; class Person : public Actor { public: void act(); virtual void fight(Person enemy); virtual void takeDamage(double dmg); // getters and setters virtual unsigned getX(); virtual void setX(unsigned amt); virtual unsigned getY(); virtual void setY(unsigned amt); virtual Weapon getWeapon(); virtual void setWeapon(Weapon w); virtual Weapon getArmor(); virtual void setArmor(Weapon a); virtual unsigned getLevel(); virtual void setLevel(unsigned amt); virtual double getHealth(); virtual void setHealth(double amt); virtual double getXP(); virtual void setXP(double amt); Person(); Person(string n); private: Weapon wep; Weapon armor; double xp; unsigned level; double health; unsigned x; unsigned y; }; class Weapon { public: double getStrength(); void setStrength(double s); double getValue(); void setValue(double amt); double getHealth(); void setHealth(double amt); string getName(); void setName(string n); string getType(); void setType(string t); Weapon(); Weapon(string n, string t, double dmg); private: string name; string type; double value; double health; double strength; }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload