gpt4 book ai didi

c++ - 字段 'buffer_' 的类型不完整 'boost::array'

转载 作者:行者123 更新时间:2023-11-30 02:27:39 25 4
gpt4 key购买 nike

我正在尝试从 Crow RESTful API 编译一个简单的 REST API 示例

但是当我运行 make all 或 make 时出现以下错误

[ 55%] Building CXX object 

examples/CMakeFiles/example_with_all.dir/example_with_all.cpp.o
In file included from /home/hinach4n/Project-Alpha/libs/crow/examples/example_with_all.cpp:1:0:
/home/hinach4n/Project-Alpha/libs/crow/examples/../amalgamate/crow_all.h:5026:42: error: field ‘buffer_’ has incomplete type ‘boost::array<char, 4096ul>’
boost::array<char, 4096> buffer_;
^
In file included from /usr/include/boost/asio/buffer.hpp:23:0,
from /usr/include/boost/asio/detail/reactive_socket_service.hpp:22,
from /usr/include/boost/asio/datagram_socket_service.hpp:30,
from /usr/include/boost/asio/basic_datagram_socket.hpp:21,
from /usr/include/boost/asio.hpp:21,
from /home/hinach4n/Project-Alpha/libs/crow/examples/../amalgamate/crow_all.h:242,
from /home/hinach4n/Project-Alpha/libs/crow/examples/example_with_all.cpp:1:
/usr/include/boost/asio/detail/array_fwd.hpp:23:7: note: declaration of ‘class boost::array<char, 4096ul>’
class array;
^
examples/CMakeFiles/example_with_all.dir/build.make:62: recipe for target 'examples/CMakeFiles/example_with_all.dir/example_with_all.cpp.o' failed
make[2]: *** [examples/CMakeFiles/example_with_all.dir/example_with_all.cpp.o] Error 1
CMakeFiles/Makefile2:321: recipe for target 'examples/CMakeFiles/example_with_all.dir/all' failed
make[1]: *** [examples/CMakeFiles/example_with_all.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

而且我查看了头文件,但我似乎无法理解问题所在!感谢您的帮助!

最佳答案

此错误消息表示头文件的定义boost::array<>尚未包括在内。

可能的修复:添加 #include <boost/array.hpp>进入 crow_all.h 的顶部.

关于c++ - 字段 'buffer_' 的类型不完整 'boost::array<char , 4096ul>',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41466451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com