C++11
boost 1.58.0
Ubuntu 16.04
cmake 3.18.2
Clion
C++ Crow depends on boost
https://www.boost.org/users/history/version_1_58_0.html
cd boost_1_58_0
. /booststrap.sh
//Sudo is required
sudo ./b2 install
Compilation and installation are complete in one or two minutes
/usr/local/include/boost
/usr/local/lib
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
In the newly created build directory, there is a binary file build/examples/example, which runs a simple http request, port number: 18080
. /example
My project here is called: crow_demo
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/)
# include <iostream>
# include "crow.h"
int main(){
crow::SimpleApp app;CROW_ROUTE(app,"/")([](){return"Hello C++ Crow";});
app.port(9876).multithreaded().run();}
Recommended Posts