编译cpp代码错误

来源:互联网 发布:淘宝手机壳销量 编辑:程序博客网 时间:2024/06/13 11:04

错误:

hdu_admin@hdu:~/neural_work/stf/cdl$ g++ -o sdk_api.so -shared -fPIC api.cppIn file included from /usr/include/c++/5/chrono:35:0,                 from api.cpp:7:/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \  ^api.cpp:85:25: warning: multi-character character constant [-Wmultichar]         header.bfType = 'MB';                         ^api.cpp:18:5: error: ‘uint16_t’ does not name a type     uint16_t bfType;

解决:

使用g++ -o sdk_api.so -shared -fPIC api.cpp -std=c++11即可