fallahn / sfml-tmxloader

SFML 2.x based tmx tilemap parser for files created with Tiled tile map editor
106 stars 35 forks source link

Missing vtable #75

Closed benajaero closed 6 years ago

benajaero commented 6 years ago

Hi I installed sfml-tmxloader by doing

cmake .
make all
make install

However I get this error

Undefined symbols for architecture x86_64:
  "tmx::MapLoader::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      Game::Start() in game.cpp.o
  "tmx::MapLoader::MapLoader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char)", referenced from:
      Game::Start() in game.cpp.o
  "vtable for DebugShape", referenced from:
      DebugShape::~DebugShape() in game.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for tmx::MapLayer", referenced from:
      tmx::MapLayer::~MapLayer() in game.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for tmx::MapLoader", referenced from:
      tmx::MapLoader::~MapLoader() in game.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
fallahn commented 6 years ago

Try explicitly adding a default destructor to each of those classes and then rebuild the lib eg:

~DebugShape() = default;
benajaero commented 6 years ago

Still shows same error.

benajaero commented 6 years ago

I managed to fix this by copying the src code directly into my project and including it that way in cmake. Therefore, I think the problem was cmake couldn't find the object code.