Я установил и собрал библиотеку Paho C с этими шагами из "https://github.com/eclipse/paho.mqtt.cpp":
$ sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
$ sudo apt-get install libssl-dev
$ sudo apt-get install doxygen graphviz`
$ sudo apt-get install libcppunit-dev
$ git clone https://github.com/eclipse/paho.mqtt.c.git
$ cd paho.mqtt.c
$ git checkout v1.3.1
$ cmake -Bbuild -H. -DPAHO_WITH_SSL=ON -DPAHO_ENABLE_TESTING=OFF
$ sudo cmake --build build/ --target install
$ sudo ldconfig
Это нормально, но затем я хочу построить сеанс c ++ с этим:
$ git clone https://github.com/eclipse/paho.mqtt.c.git
$ cd paho.mqtt.c
$ git checkout v1.3.1
$ cmake -Bbuild -H. -DPAHO_WITH_SSL=ON -DPAHO_ENABLE_TESTING=OFF
$ sudo cmake --build build/ --target install
Когда я делаю свою сборку, я сталкиваюсь со следующей ошибкой:
[ 2%] Building CXX object src/CMakeFiles/paho-cpp-objs.dir/async_client.cpp.o
In file included from /home/pi/paho.mqtt.cpp/src/mqtt/token.h:30:0,
from /home/pi/paho.mqtt.cpp/src/mqtt/async_client.h:30,
from /home/pi/paho.mqtt.cpp/src/async_client.cpp:20:
/home/pi/paho.mqtt.cpp/src/mqtt/exception.h: In static member function ‘static mqtt::string mqtt::exception::error_str(int)’:
/home/pi/paho.mqtt.cpp/src/mqtt/exception.h:91:21: error: ‘::MQTTAsync_strerror’ has not been declared
const char *msg = ::MQTTAsync_strerror(rc);
^
/home/pi/paho.mqtt.cpp/src/mqtt/exception.h: In static member function ‘static mqtt::string mqtt::exception::reason_code_str(int)’:
/home/pi/paho.mqtt.cpp/src/mqtt/exception.h:101:15: error: ‘::MQTTReasonCode_toString’ has not been declared
auto msg = ::MQTTReasonCode_toString(MQTTReasonCodes(reasonCode));
^
/home/pi/paho.mqtt.cpp/src/mqtt/exception.h:101:67: error: ‘MQTTReasonCodes’ was not declared in this scope
auto msg = ::MQTTReasonCode_toString(MQTTReasonCodes(reasonCode));
^
In file included from /home/pi/paho.mqtt.cpp/src/mqtt/token.h:35:0,
from /home/pi/paho.mqtt.cpp/src/mqtt/async_client.h:30,
from /home/pi/paho.mqtt.cpp/src/async_client.cpp:20:
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h: At global scope:
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:83:25: error: ‘MQTTAsync_successData5’ does not name a type
connect_response(const MQTTAsync_successData5* rsp) :
^
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h: In constructor ‘mqtt::connect_response::connect_response(const int*)’:
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:84:35: error: request for member ‘properties’ in ‘* rsp’, which is of non-class type ‘const int’
server_response(properties(rsp->properties)),
^
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:85:26: error: request for member ‘alt’ in ‘* rsp’, which is of non-class type ‘const int’
serverURI_(string(rsp->alt.connect.serverURI)),
^
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:86:21: error: request for member ‘alt’ in ‘* rsp’, which is of non-class type ‘const int’
mqttVersion_(rsp->alt.connect.MQTTVersion),
^
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:87:32: error: request for member ‘alt’ in ‘* rsp’, which is of non-class type ‘const int’
sessionPresent_(to_bool(rsp->alt.connect.sessionPresent)) {
^
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h: At global scope:
/home/pi/paho.mqtt.cpp/src/mqtt/server_response.h:127:43: error: expected ‘)’ before ‘*’ token
subscribe_response(MQTTAsync_successData5* rsp)
^
/home/pi/paho.mqtt.cpp/src/async_client.cpp:823:1: error: expected ‘}’ at end of input
}
^
/home/pi/paho.mqtt.cpp/src/async_client.cpp:823:1: error: expected unqualified-id at end of input
/home/pi/paho.mqtt.cpp/src/async_client.cpp:823:1: error: expected ‘}’ at end of input
src/CMakeFiles/paho-cpp-objs.dir/build.make:62: recipe for target 'src/CMakeFiles/paho-cpp-objs.dir/async_client.cpp.o' failed
make[2]: *** [src/CMakeFiles/paho-cpp-objs.dir/async_client.cpp.o] Error 1
CMakeFiles/Makefile2:126: recipe for target 'src/CMakeFiles/paho-cpp-objs.dir/all' failed
make[1]: *** [src/CMakeFiles/paho-cpp-objs.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
Я не понимаю почему. Не могли бы вы помочь мне, пожалуйста !!