本文介绍了websocketpp库中的错误和Windows Visual Studio 2015中的增强的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译以下简单示例 https:来自开发人员github的//github.com/zaphoyd/websocketpp/blob/master/examples/echo_server/echo_server.cpp ,但是我在代码之外遇到了奇怪的错误.

I'm trying to compile this simple example https://github.com/zaphoyd/websocketpp/blob/master/examples/echo_server/echo_server.cpp from the developer github, but I'm getting strange errors outside the code.

我也曾尝试打开/Za选项,如这篇文章所示:,但是抛出了一个不同的错误,说线程支持不可用:已被BOOST_DISABLE_THREADS明确禁用"

I have also tried turning on the /Za option as shown in this post: VC++ 2012 and Boost incompatibility - `throw()` specifications in library headers but it throws a different error, saying "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"

有人知道如何解决此问题吗?谢谢!

Does someone know how to fix this?thanks!

错误:我在Windows10 x64中使用Visual Studio 2015,C:\websocketpp\websocketpp/transport/base/connection.hpp(187): error C2694: 'const char *websocketpp::transport::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/base/connection.hpp(187): note: see declaration of 'websocketpp::transport::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): error C2694: 'const char *websocketpp::transport::iostream::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): note: see declaration of 'websocketpp::transport::iostream::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/error.hpp(151): error C2694: 'const char *websocketpp::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/error.hpp(151): note: see declaration of 'websocketpp::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/frame.hpp(831): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data1>C:\websocketpp\websocketpp/extensions/extension.hpp(65): error C2694: 'const char *websocketpp::extensions::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/extensions/extension.hpp(65): note: see declaration of 'websocketpp::extensions::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\local\boost_1_59_0\boost/asio/detail/config.hpp(227): warning C4005: 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition1> C:\local\boost_1_59_0\boost/asio/detail/config.hpp(213): note: see previous definition of 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT'1>C:\websocketpp\websocketpp/transport/asio/base.hpp(189): error C2694: 'const char *websocketpp::transport::asio::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/asio/base.hpp(189): note: see declaration of 'websocketpp::transport::asio::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): error C2694: 'const char *websocketpp::transport::asio::socket::socket_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): note: see declaration of 'websocketpp::transport::asio::socket::socket_category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/processors/base.hpp(165): error C2694: 'const char *websocketpp::processor::error::processor_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/processors/base.hpp(165): note: see declaration of 'websocketpp::processor::error::processor_category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/common/md5.hpp(367): warning C4267: '+=': conversion from 'size_t' to 'websocketpp::md5::md5_word_t', possible loss of data1>C:\websocketpp\websocketpp/sha1/sha1.hpp(176): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The errors:I'm using Visual Studio 2015 in Windows10 x64, C:\websocketpp\websocketpp/transport/base/connection.hpp(187): error C2694: 'const char *websocketpp::transport::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/base/connection.hpp(187): note: see declaration of 'websocketpp::transport::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): error C2694: 'const char *websocketpp::transport::iostream::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): note: see declaration of 'websocketpp::transport::iostream::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/error.hpp(151): error C2694: 'const char *websocketpp::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/error.hpp(151): note: see declaration of 'websocketpp::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/frame.hpp(831): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data1>C:\websocketpp\websocketpp/extensions/extension.hpp(65): error C2694: 'const char *websocketpp::extensions::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/extensions/extension.hpp(65): note: see declaration of 'websocketpp::extensions::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\local\boost_1_59_0\boost/asio/detail/config.hpp(227): warning C4005: 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition1> C:\local\boost_1_59_0\boost/asio/detail/config.hpp(213): note: see previous definition of 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT'1>C:\websocketpp\websocketpp/transport/asio/base.hpp(189): error C2694: 'const char *websocketpp::transport::asio::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/asio/base.hpp(189): note: see declaration of 'websocketpp::transport::asio::error::category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): error C2694: 'const char *websocketpp::transport::asio::socket::socket_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): note: see declaration of 'websocketpp::transport::asio::socket::socket_category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/processors/base.hpp(165): error C2694: 'const char *websocketpp::processor::error::processor_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'1> C:\websocketpp\websocketpp/processors/base.hpp(165): note: see declaration of 'websocketpp::processor::error::processor_category::name'1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'1>C:\websocketpp\websocketpp/common/md5.hpp(367): warning C4267: '+=': conversion from 'size_t' to 'websocketpp::md5::md5_word_t', possible loss of data1>C:\websocketpp\websocketpp/sha1/sha1.hpp(176): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

推荐答案

定义_WEBSOCKETPP_NOEXCEPT__WEBSOCKETPP_CPP11_CHRONO_对我有用:) https://github.com/zaphoyd/websocketpp/issues/437

Defining _WEBSOCKETPP_NOEXCEPT_ and _WEBSOCKETPP_CPP11_CHRONO_ did the trick for me :)https://github.com/zaphoyd/websocketpp/issues/437

这篇关于websocketpp库中的错误和Windows Visual Studio 2015中的增强的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 00:50