jsonrpcx/json-rpc-cxx

compile error on VS2019 MFC app

sdhongjun opened this issue · 1 comments

Compiling code on VS2019 MFC app typemapper.hpp will got error.

class WarehouseServer
{
public:
    WarehouseServer() : products() {}

    bool AddProduct(const Product& p);
    const Product& Getproduct(const std::string& id);
    std::vector<Product> AllProducts();

    unsigned int Test(unsigned int a, unsigned int b) { return a + b; }

private:
    std::map<std::string, Product> products;
};

void Init()
{
       WarehouseServer app;
	rpcServer.Add("GetProduct", GetHandle(&WarehouseServer::Getproduct, app), { "id" });
	rpcServer.Add("AddProduct", GetHandle(&WarehouseServer::AddProduct, app), { "product" });
	rpcServer.Add("AllProducts", GetHandle(&WarehouseServer::AllProducts, app), {});
	rpcServer.Add("Test", GetHandle(&WarehouseServer::Test, app));
}

image

I found this https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax one to fix the error. By the way how to find the api document.

Hi!

I don't think this is an issue of the library. If windows.h shadows standard C++17 symbols, I consider this an error on the calling side.

The "API Documentation" mostly exists as an example application under https://github.com/jsonrpcx/json-rpc-cxx/tree/master/examples