在编译我的小程序的时候,触发了一个编译错误,程序中使用了libmemcached,错误如下:
1
2
3
4
5
6
7
8
9
|
In file included from /usr/lib/gcc/x86_64-redhat-linux/ 4.4 . 7 /../../../../ include /c++/ 4.4 . 7 /cinttypes: 35 , from /usr/local/ include /libmemcached- 1.0 /memcached.h: 46 , from ../ include /../ include /libmemcached/memcached.h: 39 , from ../memcachedtest/memcachedtest.cpp: 8 : /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. ../memcachedtest/memcachedtest.cpp: In function ‘ int main( int , char**)’: ../memcachedtest/memcachedtest.cpp: 15 : warning: deprecated conversion from string constant to ‘char*’ ../memcachedtest/memcachedtest.cpp: 16 : warning: deprecated conversion from string constant to ‘char*’ make: *** [../memcachedtest/memcachedtest.o] Error 1 |
解决方法:
在makefile中添加:
1
|
CFLAGS := -std=gnu++0x |