c++11使用

来源:互联网 发布:矿用u型钢支架数据 编辑:程序博客网 时间:2024/06/02 02:15
在gcc中加入-std=c++11.
编译错误1
 error: ‘shared_ptr’ is not a member of ‘std’
  std::shared_ptr<net_que_handle> q_handle = make_shared<net_que_handle>();
  解决:gcc中加入-std=c++11,如cc -g -std=c++11 -o xxx
编译错误2
 unable to find string literal operator ‘operator"" __FILE__’
 #define PROXY_LOG(format,...) printf("FILE:"__FILE__",line:%05d:"format"/n",__LINE__,##__VA_ARGS__)
 错误解决:c++11要求字符串和变量拼接的时候要加空格,改为
 #define PROXY_LOG(format,...) printf("FILE:" __FILE__ ",line:%05d:" format "/n",__LINE__,##__VA_ARGS__)即可
0 0
原创粉丝点击