字段 'buffer_' 的类型不完整 'boost::array<char , 4096ul>'

field 'buffer_' has incoplete type 'boost::array<char , 4096ul>'

我正在尝试从 Crow RESTful API

编译一个简单的 REST API 示例

但是当我 运行 make all or just 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 的顶部。