Then you have to specifcy #define Tinyobject_Implementation to include the implementation in the header only.
To understand the problem, you should read C++ FAQ lite’s “why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?”. While not the exact issue described, it provides insight as to what is at play here.
First, the issue is that you apparently didn’t read the readme very thoroughly, as it states you should only define TINYOBJLOADER_IMLEMENTATION for only one translation unit: :^)
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc #include "tiny_obj_loader.h"
Second, the actual issue is that the TINYOBJLOADER_IMPLEMENTATION switches tiny_obj_loader from a symbol importer to symbol exporter. The correct set up should look something like:
// source1.cpp #define TINYOBJLOADER_IMLEMENTATION #include <tiny_obj_loader.h> // source1.cpp will contain all of tiny_obj_loader’s symbols. // source2.cpp #include <tiny_obj_loader.h> // from here, the symbols in tiny_obj_loader contains stubs, which will // be resolved when the linker links source2.obj with source1.objIf both source2.cpp and source1.cpp define TINYOBJLOADER_IMLEMENTATION, then the linker sees two different sets of identical symbols for tinyobjloader, and that’s an error.