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
Prototype of subscribe_callback
is incorrect
#2367
Comments
Here's a patch: diff --git a/lib/cpp/mosquittopp.h b/lib/cpp/mosquittopp.h
index be9016d62f102ceee8332d62ef570b53084135d5..f47535a9e96d8687d9ed4f48f43208210b63c6a4 100644
--- a/lib/cpp/mosquittopp.h
+++ b/lib/cpp/mosquittopp.h
@@ -64,7 +64,6 @@ mosqpp_EXPORT int subscribe_callback(
void *userdata,
const char *topic,
int qos=0,
- bool retained=true,
const char *host="localhost",
int port=1883,
const char *client_id=NULL, |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The prototype of
subscribe_callback
in mosquitopp.h doesn't match the function definition in mosquittopp.cpp -- the one in the header has a parameterbool retained
that doesn't appear in the impl.The result is that client code that calls this function will produce a link error, since it's calling a function with a different mangled name than the one implemented. There will also be a warning or error if compiling with strict prototype checking:
It looks as though the parameter should be removed from the header. The implementation just calls through to
mosquitto_subscribe_callback
, which has no correspondingretained
parameter, so there's no point in passing one to the C++ function.The text was updated successfully, but these errors were encountered: