首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EasyLoging8.91没有c++11就不能编译

EasyLoging8.91没有c++11就不能编译
EN

Stack Overflow用户
提问于 2015-03-30 01:17:26
回答 1查看 936关注 0票数 0

我想使用没有C++11的库,但它不会为我编译:(理论上它应该按照文档@http://easylogging.muflihun.com:“对于较低版本的C++ (非C++11),请考虑使用Easylogging++ v8.91。")

error:#error此文件需要支持C++ 2011标准的编译器和库。这种支持目前还处于实验阶段,必须使用-std=c++11或-std=gnu++11编译器选项来启用。

文件结构:

./Main.cpp./logger/easylogging++.h

Main.cpp的内容:

代码语言:javascript
复制
#include "logger/easylogging++.h"
_INITIALIZE_EASYLOGGINGPP
using namespace std;

int main(int argc, char* argv[]) {
LINFO << "This is my first log";
return 0;
}

../src/logger/easylogging++.h: In function‘std::string easyloggingpp::internal::threading::getCurrentThreadId()’:../src/logger/easylogging++.h:691:16: error:’std::this_thread‘尚未声明为ss << std::this_thread::get_id();

编译器: gcc 4.8.2版(Ubuntu 4.8.2-19ubuntu1),操作系统: Ubuntu 14.04 LTS

EN

回答 1

Stack Overflow用户

发布于 2016-09-08 10:36:36

正如T.C.在解决方案中建议的那样,更改easylogging++.h顶部的这段代码:

代码语言:javascript
复制
#if defined(__GNUC__)
#   define _ELPP_GCC_VERSION (__GNUC__ * 10000 \
                               + __GNUC_MINOR__ * 100 \
                               + __GNUC_PATCHLEVEL__)
#   if defined(__GXX_EXPERIMENTAL_CXX0X__)
#      define _ELPP_CXX0X 1
#   elif (_ELPP_GCC_VERSION >= 40801)
#      define _ELPP_CXX11 1
#   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#endif // defined(__GNUC__)

_ELPP_CXX0X_ELPP_CXX11都更改为0将解决此问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29332253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档