Getting undefined reference to vtable errors
I'm guessing it's because I've written this incorrectly, but I'm not sure what to look up in order to figure out what's wrong.
undefined reference to `vtable for Entity' on line 13
Entity.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// Entity.cpp
#include "Entity.h"
#include <typeinfo>
#include <iostream>
Entity::Entity(std::string sName="Unnamed", sf::Vector2f v2fPos=sf::Vector2f(0,0))
: name(sName), pos(v2fPos) // error occurs here.
{
if (DEBUG)
std::cout << "Constructing " << typeid(*this).name() << std::endl;
// etc....
}
|
Entity.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#ifndef PABLOIST_ENTITY_INCLUDED
#define PABLOIST_ENTITY_INCLUDED
#include <SFML/Graphics.hpp>
#include <cstring>
class Entity
{
public:
Entity(std::string sName, sf::Vector2f v2fPos);
std::string name;
sf::Vector2f pos;
protected:
virtual bool Init(); // initialize all entities of one type only once.
};
#endif // PABLOIST_ENTITY_INCLUDED
|
Thanks for the help!
You are missing the definition for the virtual bool Init()
function
Last edited on
Oh..wow, I feel like an idiot. Thanks.
Topic archived. No new replies allowed.