jsonrpcx / json-rpc-cxx

JSON-RPC for modern C++
MIT License
251 stars 44 forks source link

compile error on VS2019 MFC app #28

Closed sdhongjun closed 3 years ago

sdhongjun commented 3 years ago

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.

cinemast commented 3 years ago

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