2015-10-06 35 views
1

我想從開發人員github編譯這個簡單的例子https://github.com/zaphoyd/websocketpp/blob/master/examples/echo_server/echo_server.cpp,但我得到的代碼之外的奇怪的錯誤。websocketpp庫中的錯誤和Windows中的提升Visual Studio 2015

我也曾嘗試開啓/雜誌選項,如圖這篇文章:VC++ 2012 and Boost incompatibility - `throw()` specifications in library headers但它拋出不同的錯誤,稱「線程支持unavaliable:它已與BOOST_DISABLE_THREADS被明確禁用」

是否有人知道如何解決這個問題? 謝謝!

的錯誤: 我使用Visual Studio 2015年在Windows10 64, 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 data 1>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 redefinition 1> 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 data 1>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 ==========

+0

只是用Google搜索這一點,發現您的文章,它對我來說看起來像一個錯誤,它並沒有說明VS2015有constexpr和noexcept的事實。我在cpp11.h中添加了異常,但現在我得到'boost :: milliseconds'和chrono的持續時間錯誤。 boost :: asio :: basic_waitable_timer ,boost :: asio :: waitable_timer_service > :: basic_waitable_timer(const boost :: asio :: basic_waitable_timer >&)':不能將參數2從'boost :: chrono :: milliseconds'轉換爲'c – Anonymous

回答

2

定義_WEBSOCKETPP_NOEXCEPT__WEBSOCKETPP_CPP11_CHRONO_的伎倆對我來說:) https://github.com/zaphoyd/websocketpp/issues/437

+3

謝謝!這對我行得通。只是爲了幫助其他可能有同樣問題的人,我不得不補充: '#define _WEBSOCKETPPPP_NOEXCEPT_ 1 #define _WEBSOCKETPP_CPP11_CHRONO_ 1 #include <...' – Isaac

相關問題