Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: 'auto' not allowed in lambda parameter #53

Open
peder2key opened this issue Jun 16, 2020 · 4 comments
Open

error: 'auto' not allowed in lambda parameter #53

peder2key opened this issue Jun 16, 2020 · 4 comments

Comments

@peder2key
Copy link

Hello!

I am getting this error in json_rpc_server.cpp: error: 'auto' not allowed in lambda parameter

in method:
QString logInvoke(const QMetaMethod& meta_method,
const QVariantList& args,
const QVariant& return_value)
{
const auto ns = meta_method.parameterNames();
auto ps = jcon::variantListToStringList(args);
QStringList args_sl;
std::transform(ns.begin(), ns.end(), ps.begin(),
std::back_inserter(args_sl),
[](auto x, auto y) -> QString {
return static_cast(x) + ": " + y;
}
);

auto msg = QString("%1 invoked ")
    .arg(static_cast<QString>(meta_method.name()));

if (args_sl.empty()) {
    msg += "without arguments";
} else {
    msg += QString("with argument%1: %2")
        .arg(args_sl.size() == 1 ? "" : "s")
        .arg(args_sl.join(", "));
}

if (return_value.isValid()) {
    msg += " -> returning: " + jcon::variantToString(return_value);
}

return msg;

}

not sure why?

best regards

@joncol
Copy link
Owner

joncol commented Jun 17, 2020

Hi, could you try reformatting that code so that it's easier to follow what you're asking?

@peder2key
Copy link
Author

I just downloaded the code and tried to compile it with Qt5.15.0.. But this dont seem to be the problem for windows, but I am getting this error:

error: definition of static data member 'jcon::JsonRpcServer::InvalidRequestId' of dllimport'd class
const QString JsonRpcServer::InvalidRequestId = "";

Have you tested it with Qt5.15.0?

Best regards

@joncol
Copy link
Owner

joncol commented Jun 17, 2020

Just tried Qt 5.15, and had to suppress a deprecation warning (pushed the change to master), but other than that it should work fine (I'm on Arch Linux though, I haven't tried it on Windows).

@peder2key
Copy link
Author

Thanks!

I was able to compile it on my mac, but when i tested the example code this was the result:

Creating TCP server
RPC error: "method 'getRandomInt' not found, check name and parameter types " ( -32601 )
RPC error: "method 'getRandomInt' not found, check name and parameter types (-32601)"
RPC error: "method 'printMessage' not found, check name and parameter types (-32601)"
Waiting for 2 outstanding requests
Calling QCoreApplication::processEvents()
RPC error: "method 'printMessage' not found, check name and parameter types " ( -32601 )
Calling QCoreApplication::processEvents()
RPC error: "method 'namedParams' not found, check name and parameter types " ( -32601 )
Creating TCP server
RPC error: "method 'ex/myFirstNamespace/getRandomInt' not found, check name and parameter types (-32601)"
RPC error: "method 'ex/myOtherNamespace/getRandomInt' not found, check name and parameter types (-32601)"
No outstanding requests, quitting

Any tips for why it is failing?

Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants