Skip to content

Compilation error when using Boost #1069

@StefanoPetrilli

Description

@StefanoPetrilli

While working on #1066, I noticed that when running the following command to build using BOOST:

mkdir build && cd build
cmake .. -DCROW_USE_BOOST=ON
cmake --build . --target all

I get the following compilation error:

[ 92%] Building CXX object tests/CMakeFiles/unittest.dir/unittest.cpp.o
/home/stefano/repos/Crow/tests/unittest.cpp: In lambda function:
/home/stefano/repos/Crow/tests/unittest.cpp:4152:15: error: ‘error_code’ is not a member of ‘boost::asio’
 4152 |         asio::error_code error;
      |               ^~~~~~~~~~
/home/stefano/repos/Crow/tests/unittest.cpp:4152:15: note: suggested alternatives:
In file included from /usr/include/c++/13/bits/ios_base.h:46,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from /home/stefano/repos/Crow/tests/unittest.cpp:6:
/usr/include/c++/13/system_error:223:9: note:   ‘std::error_code’
  223 |   class error_code
      |         ^~~~~~~~~~
In file included from /home/stefano/repos/Crow/include/crow.h:26,
                 from /home/stefano/repos/Crow/tests/unittest.cpp:13:
/home/stefano/repos/Crow/include/crow/http_server.h:36:11: note:   ‘crow::error_code’
   36 |     using error_code = boost::system::error_code;
      |           ^~~~~~~~~~
In file included from /usr/include/boost/system/error_code.hpp:13,
                 from /usr/include/boost/asio/detail/throw_error.hpp:20,
                 from /usr/include/boost/asio/detail/impl/posix_event.ipp:23,
                 from /usr/include/boost/asio/detail/posix_event.hpp:172,
                 from /usr/include/boost/asio/detail/event.hpp:25,
                 from /usr/include/boost/asio/execution/blocking_adaptation.hpp:19,
                 from /usr/include/boost/asio/execution.hpp:22,
                 from /usr/include/boost/asio/any_completion_executor.hpp:22,
                 from /usr/include/boost/asio.hpp:20,
                 from /home/stefano/repos/Crow/include/crow/socket_adaptors.h:4,
                 from /home/stefano/repos/Crow/include/crow.h:7:
/usr/include/boost/system/detail/error_code.hpp:64:7: note:   ‘boost::system::error_code’
   64 | class error_code
      |       ^~~~~~~~~~
/home/stefano/repos/Crow/tests/unittest.cpp:4156:60: error: ‘error’ was not declared in this scope
 4156 |             size_t len = c.read_some(asio::buffer(buffer), error);
      |                                                            ^~~~~
/home/stefano/repos/Crow/tests/unittest.cpp:4156:60: note: suggested alternatives:
In file included from /usr/include/boost/asio/detail/impl/posix_event.ipp:24:
/usr/include/boost/asio/error.hpp:66:11: note:   ‘boost::asio::error’
   66 | namespace error {
      |           ^~~~~
In file included from /usr/include/boost/asio.hpp:161:
/usr/include/boost/asio/placeholders.hpp:65:22: note:   ‘boost::asio::placeholders::error’
   65 | inline boost::arg<1> error()
      |                      ^~~~~
gmake[2]: *** [tests/CMakeFiles/unittest.dir/build.make:76: tests/CMakeFiles/unittest.dir/unittest.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:716: tests/CMakeFiles/unittest.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions