0

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

pan
  • 58
  • 2
  • 8
  • Possible duplicate of https://stackoverflow.com/questions/19821041/g-ld-symbols-not-found-for-architecture-x86-64 – MrEricSir Mar 02 '18 at 00:14
  • This is not a duplicate of that earlier question. My `#include`s match those in the tutorial and I am not mistakingly including any `.cpp` files. – pan Mar 02 '18 at 00:59

0 Answers0