jeudi 1 mars 2018

Undefined reference with JsonBox getObject

I'm working off of this tutorial on the items part. http://www.penguinprogrammer.co.uk/rpg-tutorial/items/

My code for item.cpp looks like this

#include "item.hpp"
#include "entity.hpp"
#include "JsonBox.h"
#include "entitymanager.hpp"

Item::Item(std::string id, std::string name, std::string description) : Entity(id) {
    this->name = name;
    this->description = description;
}

Item::Item(std::string id, JsonBox::Value& val, EntityManager* mgr) : Entity(id) {
    this->Load(val, mgr);
}

void Item::Load(JsonBox::Value& val, EntityManager* mgr) {
    JsonBox::Object obj = val.getObject();
//    this->name = obj["name"].getString();
//    this->description = obj["description"].getString();
}

and it is getting this error

Undefined symbols for architecture x86_64:
  "JsonBox::Value::Value(JsonBox::Value const&)", referenced from:
      std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, JsonBox::Value>::pair(std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, JsonBox::Value> const&) in item.o
  "JsonBox::Value::~Value()", referenced from:
      std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, JsonBox::Value>::~pair() in item.o
  "JsonBox::Value::getObject() const", referenced from:
      Item::Load(JsonBox::Value&, EntityManager*) in item.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How do fix the linker for this?

For reference, the JsonBox library is here https://github.com/anhero/JsonBox and the tutorial repo is here https://github.com/dbMansfield/cpp-rpg-tutorial

Aucun commentaire:

Enregistrer un commentaire