赞
踩
vcpkg install crow安装crow
- // main.cpp
- #include <crow.h>
-
- int main()
- {
- crow::SimpleApp app;
-
- CROW_ROUTE(app, "/")
- ([]{
- return "Hello, World!";
- });
-
- app.port(8080).multithreaded().run();
-
- return 0;
- }
-
- //CMakeLists.txt
- cmake_minimum_required(VERSION 3.10)
-
- project(HelloWorld)
-
- add_executable(HelloWorld main.cpp)
- find_package(Crow CONFIG REQUIRED)
- target_link_libraries(main PRIVATE Crow::Crow)
-
- target_link_libraries(HelloWorld PRIVATE Crow::Crow)
编译运行之后访问127.0.0.1:8080
就可以看到Hello,World!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。