samedi 7 octobre 2017

C++ REST SDK server implementation URI giving errors

I am trying to write my own implementation of REST server using C++ REST SDK. the class used is http_listener. Almost all of it compiles properly but when i try to buld a URI using class web::http::URI it gives me error, also if pass the URI to http_listener class it giving error. below us the code that gives error.

void CPPRESTSERVER::Start()
{
    //building the URI//
    utility::string_t address = "http://";
    address.append(m_IP);
    address.append(":");
    address.append(std::to_string(m_port));
    address.append("/");
    m_Uri(U(address)); //m_Uri class member of type web::http::uri
    //m_CustUri(m_Uri);
    //m_CustUri.append_path(m_pathIP);
    //m_CustUri.set_port(m_port);
    //*******************
    m_rstServer(U(m_Uri.to_string())); //m_rstserver class member of type http_listener
    m_rstServer.support(web::http::methods::GET, std::bind(&CPPRESTSERVER::handle_GET, this, std::placeholders::_1));
}

i have tried the below

1) m_Uri(U(address)); also as m_Uri(address); but still giving errors.
2) m_rstServer(U(m_Uri.to_string())); also as  m_rstServer(m_Uri.to_string()); also as  m_rstServer(m_Uri); also as  m_rstServer(U(m_Uri));

but still they give errors eventhough they have respective cusntructors of functions accepting argumets of required type

CPPRESTSERVER.cpp:57:21: error: no match for call to ‘(web::uri) (utility::string_t&)’
     m_Uri(U(address));
                     ^
CPPRESTSERVER.cpp:62:25: error: no match for call to ‘(web::http::experimental::listener::http_listener) (web::uri&)’
     m_rstServer(U(m_Uri.to_string()));

any suggestions?????? i have stuck due these two errors. also i am compiling in ubuntu with C++11 standard.

Aucun commentaire:

Enregistrer un commentaire