I am trying to use Casablanca, http server. to do so, I need to include headers files from Casablanca, which contains few macro and typedef that cause issues in my project.
so my file look like this.
simplehttpserver.h
#include "cpprest/json.h"
#include "cpprest/http_listener.h"
#include "cpprest/uri.h"
#include "cpprest/asyncrt_utils.h"
SimpleHttpServer {
SimpleHttpServer(utility::string_t, std::function<void(http_request)> &request_handler);
void OnInitialize();
void StartServer();
void StopServer();
private:
std::unique_ptr<http_listener> m_listenerUptr;
// Handlers
std::function<void(http::http_request)> m_all_requests;
pplx::task<void> open() { return m_listenerUptr->open(); }
pplx::task<void> close() { return m_listenerUptr->close(); }
// SimpleHttpServer http_server_;
utility::string_t address_;
}
Say in my original code where I want to include this.
#include "simplehttpserver.h"
this causes all Casablanca header files pre-compiled into my project which conflicts with macros and typedef in my project. e.g. __declspec
I don't want to change my macros cause that will be lot of code change. and I don't want to change Casablanca header files, cause that will also cause long term maintenance overhead.
I am sure, this must be very common problem in c++, can someone please help me how can resolve this.
thanks in advance.