怎么做个人网站的,中国联通网站备案,企业网络营销策划方案范文,现在开网站做微商赚钱吗目录
升级gcc版本
下载cpp-httplib的zip安装包#xff0c;上传到服务器
编辑 简单使用 首先打开gittee,搜索cpp-httplib,选择其中一个即可 也可以点下方链接 cpp-httplib库#xff1a;cpp-httplib: cpp-httplib (gitee.com) 注意#xff1a;cpp-httplib在使用的时候需…目录
升级gcc版本
下载cpp-httplib的zip安装包上传到服务器
编辑 简单使用 首先打开gittee,搜索cpp-httplib,选择其中一个即可 也可以点下方链接 cpp-httplib库cpp-httplib: cpp-httplib (gitee.com) 注意cpp-httplib在使用的时候需要使用较新版本的gcccentos 7默认gcc 4.8.5 通过如下命令查看gcc版本 [rootiZbp1f6xfzvrfki6wwxqjvZ ~]# gcc -v Using built-in specs. COLLECT_GCCgcc COLLECT_LTO_WRAPPER/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix/usr --mandir/usr/share/man --infodir/usr/share/info --with-bugurlhttp://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threadsposix --enable-checkingrelease --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-stylegnu --enable-languagesc,c,objc,obj-c,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tunegeneric --with-arch_32x86-64 --buildx86_64-redhat-linux Thread model: posix gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 用老的编译器要么编译不通过要么直接拿报错如果需要升级gcc版本可按照如下步骤 升级gcc版本
1安装scl源 yum install centos-release-scl scl-utils-build 2 安装7版本的gcc yum install -y devtoolset-7-gcc devtoolset-7-gcc-c 3查看安装结果 [rootiZbp1f6xfzvrfki6wwxqjvZ ~]# ls /opt/rh/devtoolset-7/ enable root 4启动细节命令行启动只能在本会话有效 scl enable devtoolset-7 bash //因此如果要使它每次都生效将上述指令添加进如下文件这样每次启动的时候都会执行这个scl命令如此每次登录的时候都是较新的gcc vim ~/.bash_profile 下载cpp-httplib的zip安装包上传到服务器 最新的cpp-httplb在使用的时候如果gcc不是特别新的话就有可能会有运行时错误的问题 建议cpp-httplib 0.7.15 1选择标签 2选择0.7.15版本 3开始下载 4传送到linux系统上 5对该压缩包进行解压 unzip cpp-httplib-v0.7.15.zip 后续我们主要使用httplib.h这个库 简单使用 #include cpp-httplib/httplib.h int main() { httplib::Server svr; //10.101.101.1/hi svr.Get(/hi,[](const httplib::Request req,httplib::Response resp){ resp.set_content(hello world!,text/plain; charsetutf-8); }); svr.listen(0.0.0.0,8082); return 0; }
验证是否运行 netstat -ntlp