我想在 Debian Linux 11 中编译和测试 Crow C++ 微框架:
下载最新的
crow.deb
,目前 crow-v1.0+1.deb .安装它:
$ sudo dpkg -i crow-v1.0+1.deb Selecting previously unselected package crow. (Reading database ... 587955 files and directories currently installed.) Preparing to unpack crow-v1.0+1.deb ... Unpacking crow (1.0+1) ... Setting up crow (1.0+1) ...
使用 crowcpp.org 中的示例代码创建一个
.cpp
文件:$ echo '#include "crow.h" int main() { crow::SimpleApp app; CROW_ROUTE(app, "/")([](){ return "Hello world"; }); app.port(18080).run(); }' > crowtest.cpp
尝试编译它:
$ g++ crowtest.cpp -lpthread In file included from /usr/include/crow.h:2, from crowtest.cpp:1: /usr/include/crow/query_string.h:9:10: fatal error: boost/optional.hpp: No such file or directory 9 | #include <boost/optional.hpp> | ^~~~~~~~~~~~~~~~~~~~ compilation terminated.
请参阅上面的错误。如何编译 Crow 示例代码?
最佳答案
您需要安装 Boost,对于 Debian,这将是 apt install libboost-dev
。
关于c++ - 无法编译 Crow 示例 - boost/optional.hpp : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71989024/