I'm starting an OpenGL engine, using SFML as context and input managers, GLSDK for the loading of OpenGL (and images and things not important now) and Boost for some other things.
I've been wondering around in the 'logging' idea, and tried Boost.Log (failed to compile an example, and the only reference to the problem is unsolved), Log4CPP (that gave errors at startup) and finally everything seemed to be fine with easylogging++, being a header-only library (horray!) that had some neat syntax IMO.
But it gives a bunch of errors when compiling:
C2664: 'el::base::utils::DateTime::gettimeofday' : cannot convert parameter 1 from 'int *' to 'el::base::utils::timeval *'
C2228: left of '.tv_usec' must have class/struct/union
- C2227: left of '->tv_usec' must point to class/struct/union/generic type
- C2079: 'currTime' uses undefined struct 'el::base::utils::timeval'
- C2027: use of undefined type 'el::base::utils::timeval'
- and some more
I have implemented it this way:
- 'helpers.Log.hpp': pragma once, includes 'easylogging++.h' and defines namespace helpers > namespace log > void function init().
'helpers.Log.cpp': '_INITIALIZE_EASYLOGGINGPP' and implements init() as it follows:
el::Configurations conf("../log_config.cfg"); el::Loggers::reconfigureLogger("default", conf); el::Loggers::reconfigureAllLoggers(conf);
Now, just those two files deal with logging. 'engine.Core.hpp' includes 'helpers.Log.hpp', 'engine.Boot.hpp' (blank by now), 'glload/gl_load.hpp', 'glload/gl_3_3.hpp' and in the constructor of the Core class, inside the engine namespace, the init() function is called.
Nothing else is done in the entire application. Just that, the initialization of the logging system, but it fails completely.
SYSTEM INFORMATION
OS: Windows 7 x64
IDE: Visual Studio 2012
COMPILER: VS2012 (v110)
COMPILE COMMAND: cl /c /IF:/BTSync/prog_projs/KINGDOMS/trunk/inc /IF:/dev/SFML/21/include /IF:/dev/GLSDK/052/glload/include /IF:/dev/GLSDK/052/glutil/include /IF:/dev/GLSDK/052/glm /IF:/dev/GLSDK/052/glmesh/include /IF:/dev/GLSDK/052/glimage/include /IF:/dev/BOOST/154 /IF:/DEV/LIBROCKET/121_3/include /Zi /nologo- /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fo"KINGDOMS_0_1.dir\Debug\" /Fd"F:/BTSync/prog_projs/KINGDOMS/trunk/pro/Debug/KINGDOMS_0_1_d.pdb" /Gd /TP /analyze- /errorReport:prompt ..\src\engine.Boot.cpp ..\src\engine.Core.cpp ..\src\engine.Interfaces.cpp ..\src\helpers.Log.cpp ..\src\main.cpp
EDIT BEFORE PUBLICATION: Okay, so it looks like 'glload/gl_3_3.hpp' is the problem here. It manages to break easylogging++. That is over me. How is that even possible? What can i do?
EDIT TO ADD REAL CODE
engine.Core.hpp
#pragma once
#include <glload/gl_load.hpp>
#include <glload/gl_4_4.hpp>
#include <helpers.Log.hpp>
namespace engine
{
class Core
{
public:
Core();
~Core();
};
}
engine.Core.cpp
#include <engine.Core.hpp>
engine::Core::Core()
{
helpers::log::init();
}
engine::Core::~Core()
{
}
helpers.Log.hpp
#pragma once
#include <easylogging++.h>
namespace helpers
{
namespace log
{
void init();
}
}
helpers.Log.cpp
#include <helpers.Log.hpp>
_INITIALIZE_EASYLOGGINGPP
void helpers::log::init()
{
el::Configurations conf("../log_config.cfg");
el::Loggers::reconfigureLogger("default", conf);
el::Loggers::reconfigureAllLoggers(conf);
}
I fixed it by adding
just after:
in easylogging++.h
It contains a definition of timeval struct. It looks like they forgot about it.