專案環境搭建
- 1. 更新gcc版本
- (1)查看gcc版本資訊
- (2)更新gcc版本
- 2. 安裝jsoncpp庫
- 4. 安裝Boost庫
- 5. 安裝谷歌的ctemplate庫
- 6. 安裝http協議庫
- 7. 創建專案目錄
1. 更新gcc版本
(1)查看gcc版本資訊
gcc -v
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
- 列印出來的資訊最后一行顯示你的gcc版本是大于或等于6的版本,那么OK,你不需要做任何更新,如果是4點幾的版本 你就要更新啦
(2)更新gcc版本
第一步:使用root權限運行下列命令
yum -y install centos-release-scl
yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
第二步:使用普通權限運行下列命令
vim ~/.bash_profile
在打開的vim編輯框的最后一行加入下列代碼:
scl enable devtoolset-7 bash

第三步:使修改的bash_profile生效,仍然是普通權限
source ~/.bash_profile
第四步:查看gcc版本資訊
[gongruiyang@localhost project_OJ]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.3.1-20180303/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
- 若是7.3.1版本就沒問題啦
2. 安裝jsoncpp庫
- 使用
root權限運行下面命令
yum install jsoncpp
yum install jsoncpp-devel
4. 安裝Boost庫
sudo yum install -y snappy-devel boost-devel zlib-devel.x86_64 python-pip
sudo pip install BeautifulSoup4
5. 安裝谷歌的ctemplate庫
git clone https://gitee.com/HGtz2222/ThirdPartLibForCpp.git
cd ./ThirdPartLibForCpp/el7.x86_64/
sh install.sh
- 該專案需要的是
ThirdPartLibForCpp/el7.x86_64/third_part/include/ctemplate中的template.h檔案
6. 安裝http協議庫
git clone https://gitee.com/iqxg/cpp-httplib.git
- 該專案需要的檔案是
cpp-httplib檔案夾中的httplib.h檔案
cpp-httplib\httplib.h
7. 創建專案目錄
在自己的希望的位置創建一個專案檔案夾,這個檔案夾中包含三個子檔案夾
[gongruiyang@localhost project_OJ]$ tree OJ
OJ
├── bin # 該目錄用于存放 可執行程式 + 組態檔
├── code # 該目錄用于存放 專案原始碼
└── test # 該目錄用于存放 測驗代碼
將 httplib.h和template.h兩個檔案放入code檔案夾中
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/267462.html
標籤:其他
上一篇:GFS分布式檔案系統---------值的擁有的可擴展的分布式檔案系統,大企業用了都說好
下一篇:MongoDB的安裝
