websocketpp icon indicating copy to clipboard operation
websocketpp copied to clipboard

Compilation errors on QNX 6.6.0

Open bbDSA opened this issue 10 years ago • 2 comments

Compiler: QCC 4.7.3 Include headers:

include <websocketpp/config/asio_no_tls.hpp>

include <websocketpp/server.hpp>

include

Compilation errors: C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/utilities.hpp: In member function 'bool websocketpp::utility::ci_less::nocase_compare::operator()(const unsigned char&, const unsigned char&) const': C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/utilities.hpp:81:31: error: 'tolower' was not declared in this scope

C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/impl/utilities_impl.hpp: In function 'std::string websocketpp::utility::to_lower(const string&)': C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/impl/utilities_impl.hpp:39:54: error: '::tolower' has not been declared

C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp: In member function 'void websocketpp::transport::asio::connection::handle_post_init_timeout(websocketpp::transport::asio::connection::timer_ptr, websocketpp::transport::init_handler, const std::error_code&)': C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:541:41: error: ambiguous overload for 'operator==' in 'ec == websocketpp::transport::error::operation_aborted' C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:541:41: note: candidates are: C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:541:41: note: operator==(int, int)

C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:882:42: error: ambiguous overload for 'operator==' in 'tec == websocketpp::transport::error::pass_through' C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:882:42: note: candidates are: C:/Develop/qnx-cpp/libs/websocketpp/websocketpp/transport/asio/connection.hpp:882:42: note: operator==(int, int)

There are several more compilation errors regarding the error codes but I assume that most of them have the same source,

bbDSA avatar Dec 14 '15 07:12 bbDSA

Correct headers are: #include <websocketpp/config/asio_no_tls.hpp>

#include <websocketpp/server.hpp>

#include <iostream>

bbDSA avatar Dec 14 '15 07:12 bbDSA

Had this problem while using websocketpp. The fix was to change the to_lower function in utilities_impl.hpp [line 37] as described in cppreference.com Apparently the use of ::tolower could conflict with other libs.

inline std::string to_lower(std::string const &in)
{
   std::string out = in;
   std::transform(out.begin(), out.end(), out.begin(), [](unsigned char c) { return std::tolower(c); });
   return out;
}

reference: https://en.cppreference.com/w/cpp/string/byte/tolower

Helion42 avatar May 02 '19 15:05 Helion42