g++编译使用libmemcached编写的程序时报错,做个简单的记录。
In file included from /usr/lib/gcc/x86_64-redhat-Linux/4.4.7/../../../../include/c++/4.4.7/cinttypes:35,
from /usr/include/libmemcached-1.0/memcached.h:46,
from /usr/include/libmemcached/memcached.h:39,
from main.cpp:4:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/C++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
解决方法:
makefile之前的写法是: CXX = g++
CXXFLAG = -g -Wall
在flag里加上-std=c++0x就可以编译通过啦,即:
CXX = g++
CXXFLAG = -g -Wall -std=c++0x
在.pro中添加
QMAKE_CXXFLAGS += -std=c++11