【发布时间】:2022-01-02 21:56:06
【问题描述】:
我正在尝试在我的应用程序中包含并编译一个 boost 1.77.0 websocket。
// File.h
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
Boost 是使用 vcpkg (:x64-windows) 安装的。尝试编译时,出现以下错误:
Error C2182 'executor_': illegal use of type 'void' - E:\Github\vcpkg\installed\x64-windows\include\boost\asio\impl\compose.hpp Line 64
有人遇到过这个问题吗?在这个问题上找不到任何东西。
我正在使用 Visual Studio 16.11.5 (C++17)。
注意:该项目包含.cu 文件。这可能是问题吗?在单独的解决方案中编译标头不会产生任何错误。
compose.hpp的相关部分:
template <typename Executor, typename = void>
class composed_work_guard
{
public:
typedef typename decay<
typename prefer_result<Executor,
execution::outstanding_work_t::tracked_t
>::type
>::type executor_type;
composed_work_guard(const Executor& ex)
: executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked))
{
}
void reset()
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return executor_;
}
private:
executor_type executor_; // line 64
};
【问题讨论】:
-
查看
E:\Github\vcpkg\installed\x64-windows\include\boost\asio\impl\compose.hpp第64行附近的代码可能会有所帮助 -
你说的很对。我已经更新了帖子。