Pol*_*lme 5 opengl logging glload easylogging++
我正在启动一个OpenGL引擎,使用SFML作为上下文和输入管理器,使用GLSDK加载OpenGL(以及现在不重要的图像和事物)和Boost用于其他一些事情.
我一直想知道"日志记录"的想法,并尝试了Boost.Log(未能编译示例,并且唯一的问题参考未解决),Log4CPP(在启动时出错)最后一切似乎都是使用easylogging ++很好,是一个只有标题的库(horray!),它有一些巧妙的语法IMO.
但是在编译时会出现一堆错误:
C2664:'el :: base :: utils :: DateTime :: gettimeofday':无法将参数1从'int*'转换为'el :: base :: utils :: timeval*'
C2228:'.tv_usec'的左边必须有class/struct/union
我用这种方式实现了它:
'helpers.Log.cpp':'_ INITIALIZE_EASYLOGGINGPP'并实现init(),如下所示:
el::Configurations conf("../log_config.cfg");
el::Loggers::reconfigureLogger("default", conf);
el::Loggers::reconfigureAllLoggers(conf);
Run Code Online (Sandbox Code Playgroud)现在,只有这两个文件处理日志记录.'engine.Core.hpp'包括'helpers.Log.hpp','engine.Boot.hpp'(现在空白),'glload/gl_load.hpp','glload/gl_3_3.hpp'以及在'的构造函数中核心类,在引擎名称空间内,调用init()函数.
整个应用程序中没有其他任何操作.就是这样,日志系统的初始化,但它完全失败了.
系统信息
操作系统:Windows 7 x64
IDE:Visual Studio 2012
编译器: 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
在出版之前编辑:好的,所以看起来'glload/gl_3_3.hpp'就是问题所在.它设法打破easylogging ++.那是在我身上.这怎么可能呢?我能做什么?
编辑添加真实代码
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();
};
}
Run Code Online (Sandbox Code Playgroud)
engine.Core.cpp
#include <engine.Core.hpp>
engine::Core::Core()
{
helpers::log::init();
}
engine::Core::~Core()
{
}
Run Code Online (Sandbox Code Playgroud)
helpers.Log.hpp
#pragma once
#include <easylogging++.h>
namespace helpers
{
namespace log
{
void init();
}
}
Run Code Online (Sandbox Code Playgroud)
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);
}
Run Code Online (Sandbox Code Playgroud)
我通过添加修复了它
#include <Winsock2.h>
Run Code Online (Sandbox Code Playgroud)
刚过:
#elif _ELPP_OS_WINDOWS
# include <direct.h>
# include <Windows.h>
Run Code Online (Sandbox Code Playgroud)
在 easylogging++.h 中
它包含 timeval 结构的定义。看来他们忘记了这件事。