配置开发环境

安装GCC

$ sudo apt-get update
$ sudo apt-get install build-essential manpages-dev
$ whereis gcc
$gcc --version

$gcc main.c -o main
$ ./main

安装Boost (http://osdevlab.blogspot.sg/2016/02/how-to-install-latest-boost-library-on.html)

$ mkdir boost
$ cd boost
$ wget http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.bz2
$ tar xvfo boost_1_60_0.tar.bz2

$ ./bootstrap.sh --with-libraries=date_time,filesystem,iostreams,math,regex,serialization,signals,system,thread,timer
$ sudo ./b2 install

或者

$ cd boost_1_60_0
$ ./bootstrap.sh
$ sudo ./b2 install

安装CMake (http://osdevlab.blogspot.sg/2015/12/how-to-install-latest-cmake-for.html)
CMake可以输出makefile文件, 实现项目的编译安装过程,

pi@raspberrypi ~/Download $ wget https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz
pi@raspberrypi ~/Download $ tar -xvzf cmake-3.4.1.tar.gz
pi@raspberrypi ~/Download $ cd cmake-3.4.1/
pi@raspberrypi ~/Download/cmake-3.4.1 $ sudo ./bootstrap
pi@raspberrypi ~/Download/cmake-3.4.1 $ sudo make
pi@raspberrypi ~/Download/cmake-3.4.1 $ sudo make install

创建CMakeLists.txt文件,放置在工程目录下

ccmake

#配置编译选项
cmake #生成makefile文件
make #执行makefile文件

安装MySQL (https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04)

sudo apt-get update
sudo apt-get install mysql-server #installing mysql
mysql_secure_installation #confiure --key: root
sudo systemctl status mysql.service #testing
sudo mysqladmin -p -u root version
(https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql)
sudo mysql
CREATE USER 'paofuDB'@'localhost' IDENTIFIED BY 'paofu123';
GRANT ALL PRIVILEGES ON * . * TO 'paofuDB'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS paofuDB;
paofuDB

你可能感兴趣的:(配置开发环境)