tinyobjloader/tinyobjloader

Multiple definition error

Closed this issue · 2 comments

image
cmake include:

include_directories(${CMAKE_SOURCE_DIR}/extra/TinyObjLoader)
link_directories(${CMAKE_SOURCE_DIR}/extra/TinyObjLoader)

TinyObjLoader is a directory with repository-clone

All works, only if move TINYOBJLOADER_IMPLEMENTATION code to cpp file.

syoyo commented

This is described in README and comments in the header file > only if move TINYOBJLOADER_IMPLEMENTATION code to cpp file.

#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
#include "tiny_obj_loader.h"