my dll has 2 entry points and I wish use EasyLogging++
with both entries..
I tried to use this header:
#pragma once
#ifndef EASYLOGGING_LOADER_H
#define EASYLOGGING_LOADER_H
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
#endif
but with this file included, I get the errors like this:
Error LNK2005 "class std::shared_ptr<class el::base::Storage> el::base::elStorage" (?elStorage@base@el@@3V?$shared_ptr@VStorage@base@el@@@std@@A) already defined in gInput.obj
any ideas on solve this? thanks
ps. i'm using the Easylogging++ v9.96.4
It seems that the macro
INITIALIZE_EASYLOGGINGPP
defines a variable. If you include the header file in multiple translation units then you break the one definition rule and will get an error.The simple solution is to invoke the macro only once in your whole project, by doing it in a single source file.