Simple MQTT with C++ and IDF
Posted: Wed Feb 07, 2018 11:51 pm
So far, have loved the nkolban/esp32-snippets. many thanks to nkolban!
Really, just looking for the best way to include MQTT with C++ only using the IDF (NOT Arduino).
I do have an issue though, trying to get MQTT to work, while using the other C++ libraries to work as well. I really don't need anything super fancy for the time. I was trying to use the AWS cpp library.
I'm new to binding c/c++ code together, so i'm trying to udnerstand how to pull it off.
Following the logic BLEDevice::init("");
I implemented
AWS::init("192.168.0.132", 1883);
but get compiler errors:
CXX build/main/main.o
In file included from C:/msys32/home/tyler/Pure-ESP32/ESP32/BaseStationAlphaAWS/main/main.cpp:15:0:
C:/msys32/home/tyler/Pure-ESP32/ESP32/BaseStationAlphaAWS/components/cpp_utils/AWS.h:13:43: fatal error: aws_iot_mqtt_client_interface.h: No such file or directory
compilation terminated.
make[1]: *** [/home/ESP32/esp-idf/make/component_wrapper.mk:274: main.o] Error 1
make: *** [C:/msys32/home/ESP32/esp-idf/make/project.mk:450: component-main-build] Error 2
Also, was able to get another library for MQTT working on the ESP32, https://github.com/tuanpmt/esp32-mqtt
But again, need to call that code in C++. Not sure how to go about doing this, as I was immediately getting compile errors when switching to C++
Thanks!
Really, just looking for the best way to include MQTT with C++ only using the IDF (NOT Arduino).
I do have an issue though, trying to get MQTT to work, while using the other C++ libraries to work as well. I really don't need anything super fancy for the time. I was trying to use the AWS cpp library.
I'm new to binding c/c++ code together, so i'm trying to udnerstand how to pull it off.
Following the logic BLEDevice::init("");
I implemented
AWS::init("192.168.0.132", 1883);
but get compiler errors:
CXX build/main/main.o
In file included from C:/msys32/home/tyler/Pure-ESP32/ESP32/BaseStationAlphaAWS/main/main.cpp:15:0:
C:/msys32/home/tyler/Pure-ESP32/ESP32/BaseStationAlphaAWS/components/cpp_utils/AWS.h:13:43: fatal error: aws_iot_mqtt_client_interface.h: No such file or directory
compilation terminated.
make[1]: *** [/home/ESP32/esp-idf/make/component_wrapper.mk:274: main.o] Error 1
make: *** [C:/msys32/home/ESP32/esp-idf/make/project.mk:450: component-main-build] Error 2
Also, was able to get another library for MQTT working on the ESP32, https://github.com/tuanpmt/esp32-mqtt
But again, need to call that code in C++. Not sure how to go about doing this, as I was immediately getting compile errors when switching to C++
Thanks!