Cpp web (1) Install and use Crow service under Ubuntu

Install Crow under Ubuntu

#1 surroundings##

C++11
boost 1.58.0
Ubuntu 16.04
cmake 3.18.2 
Clion

#2 installation##

#2.1 Install Boost

C++ Crow depends on boost

  1. Download boost source

https://www.boost.org/users/history/version_1_58_0.html

  1. Enter the unzipped file
cd boost_1_58_0
  1. carried out
. /booststrap.sh
//Sudo is required
sudo ./b2 install 

Compilation and installation are complete in one or two minutes

#2.2 Install Crow

  1. Download the Crow source code

I installed Crow here under the path /home/trunk/

cd /home/trunk/
git clone  https://github.com/ipkn/crow.git
cd  crow 
mkdir build
cd build
cmake ..
make
ctest 
  1. Test whether the Crow installation is successful

In the newly created build directory, there is a binary file build/examples/example, which runs a simple http request, port number: 18080

. /example

#3 use##

#3.1 Clion

  1. Use Clion to create the simplest project

My project here is called: crow_demo

  1. Configure CMakeLists.txt
cmake_minimum_required(VERSION 3.17)project(crow_demo)set(CMAKE_CXX_STANDARD 11)set(BOOST_ROOT "/usr/local/include/boost")set(BOOSTROOT "/usr/local/include/boost")include_directories(/usr/local/include)link_directories(/usr/local/lib)FIND_PACKAGE(Threads REQUIRED)SET(Boost_USE_MULTITHREADED ON)find_package(Boost REQUIRED COMPONENTS system)add_executable(crow_demo main.cpp)target_link_libraries(crow_demo boost_thread boost_system ${CMAKE_THREAD_LIBS_INIT})include_directories(/home/trunk/crow/include/)
  1. main.cpp
# include <iostream>
# include "crow.h"

int main(){
 crow::SimpleApp app;CROW_ROUTE(app,"/")([](){return"Hello C++ Crow";});

 app.port(9876).multithreaded().run();}


Recommended Posts

Cpp web (1) Install and use Crow service under Ubuntu
Install and use dig under ubuntu/debian
Install and deploy Gerrit under Ubuntu
Install nodejs and npm under Ubuntu 16.04
Install and use docker under CentOS 6.8
Compile and install QEMU under Ubuntu
Talk about | Install and use Linux system Ubuntu under Win10
Install and use Git and GitHub on Ubuntu Linux
How to install and use Curl on Ubuntu 18.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to install and use Composer on Ubuntu 20.04
How to install and use PostgreSQL on Ubuntu 16.04
How to install and use Docker on Ubuntu 16.04
Install apache+PHP under Ubuntu
Install node.js under Ubuntu
Install python3.6 under Ubuntu 16.04
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
[python] python2 and python3 under ubuntu
Use iptables under ubuntu
2018-09-11 Install arduino under Ubuntu
Install MySQL under Ubuntu
Install Yarm-PM2 under Ubuntu
Install win7 and archlinux on hard disk under ubuntu
How to install and use MySQL Workbench on Ubuntu 18.04
Compile and install OpenJDK8 from source code under Ubuntu 18.04.1
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
Open SSH service under Ubuntu
Use sublime tex under ubuntu
ubuntu install and configure GitLab
Use of mediawiki under ubuntu
Install server-side Shadowsocks under Ubuntu 16.04
Open SSH service under Ubuntu
DNS service construction under Ubuntu
Ubuntu16.04 install SVN and configuration
Ubuntu16.04 install and uninstall VMware-Workstation 14
Install rgl package under Ubuntu
[Daily] Install php pdo extension and import database under ubuntu
Method steps for installing and configuring SSH service under Ubuntu 18.04
Install and configure keepalived under CentOS 5.9
Compile and install LAMP under Centos 5.2
Use Nginx and u under CentOS
Use QQ under Ubuntu 13.10, suitable for 14.10
Install 3 single-cell R packages under Ubuntu
Install and configure Docker in Ubuntu
Ubuntu16.04 configuration OpenCV3.4.2 and basic use
Install MySQL under Ubuntu 18.04 (graphic tutorial)
Install JDK1.8 original under Ubuntu Kylin
Redis installation under ubuntu and windows
Small tool: install screenshot tool under ubuntu
Install Python3 and ansible under CentOS8
CentOS7 install and use SQL Server
Ubuntu 20.04 use must install tool software
Install Python3 and Py under CentOS7
Coexistence of CUDA8.0 and CUDA9.0 under Ubuntu 16.04
How to install Audacious under Ubuntu
How to install Tensorflow under ubuntu 16.04