I have tried cross-compiling some small C++ code for a Raspberry Pi Model 3b using my Windows machine via Ubuntu-20.04 on WSL2. It uses the Paho MQTT C and C++ libraries to subscribe to and sometimes publish some messages. I'm pretty sure that most of it works since MQTT subscriptions work, as well as publishing messages using a QoS of 0.
However, when publishing with a QoS of 1 or 2, I get a runtime error:
MQTT error [-9]: Invalid QoS value
When I try publishing with a QoS less than 0 or greater than 2, I get this instead:
MQTT error [-9]: Bad QoS
I have compiled the same code in the RPi itself and the code runs without any issues.
I'm not completely sure what is happening, but I tried checking why I'm getting the same reason code but different error messages. It appears that the Bad QoS
message is written in mqtt/message.h, which can be found in the C++ library, while the Invalid QoS Value
can be found in MQTTAsync.c, from the C library.