Go Down

Topic: MQTT.h: No such file or directory (Read 787 times) previous topic - next topic

Mar 30, 2019, 03:06 am Last Edit: Mar 30, 2019, 03:07 am by adamaero
Here is the program:
https://github.com/debsahu/ESP-MQTT-AWS-IoT-Core

I downloaded the libraries:


Code: [Select]
C:\Users\Adam\Documents\Arduino\ESP-MQTT-AWS-IoT-Core-master\ESP-MQTT-AWS-IoT-Core-master\Arduino\MQTT\MQTT.ino:9:18: fatal error: MQTT.h: No such file or directory

 #include <MQTT.h>

                  ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 0.9 (ESP-12 Module).


What am I missing?

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.


pert

That tutorial is very outdated. Support for dashes in folder names was added years ago. I noticed some other problems with that tutorial too. Usually the Adafruit documentation is of higher quality. I prefer the official Arduino guide:
https://www.arduino.cc/en/guide/libraries

The error you got has nothing to do with dashes in the folder names. It means that the Arduino IDE could not find the file MQTT.h in any of your installed libraries. From your screenshot, it seems that you expect the library in the arduino-mqtt-master folder to provide that file. Please provide a screenshot or directory listing that shows the contents of the arduino-mqtt-master folder and its src subfolder, if it has one.

#4
Mar 30, 2019, 01:04 pm Last Edit: Mar 30, 2019, 03:23 pm by adamaero
 Here are the libraries (I didn't change them):

PubSubClient https://github.com/knolleary/pubsubclient communication (choose 1)

ArduinoJSON https://github.com/bblanchon/ArduinoJson

Arduino MQTT https://github.com/256dpi/arduino-mqtt communication (choose 1)






However, says in the readme, "use PlatformIO and it will take care of installing" them. But I don't know how to use PlatformIO or why it should be used.

pert

Please verify that File > Preferences > Sketchbook location in the Arduino IDE is set to C:\Users\Adam\Documents\Arduino.

If it's already set to that, please post a screenshot of the contents of C:\Users\Adam\Documents\Arduino\libraries\arduino-mqtt-master. Your screenshot above only shows the contents of its src subfolder.

Here are the libraries (I didn't change them):

PubSubClient https://github.com/knolleary/pubsubclient communication (choose 1)

ArduinoJSON https://github.com/bblanchon/ArduinoJson

Arduino MQTT https://github.com/256dpi/arduino-mqtt communication (choose 1)
The only one you need to think about is arduino-mqtt. That's the library that contains MQTT.h.

However, says in the readme, "use PlatformIO and it will take care of installing" them. But I don't know how to use PlatformIO or why it should be used.
Don't worry about that. PlatformIO is an alternative to the Arduino IDE, for advanced users.

#6
Mar 30, 2019, 10:35 pm Last Edit: Mar 30, 2019, 10:37 pm by adamaero
Nothing was changed from GitHub:

#7
Mar 30, 2019, 10:43 pm Last Edit: Mar 30, 2019, 11:10 pm by adamaero
Maybe something's in the wrong place:




pert

It's really difficult for me to get an idea of your folder structure from these screenshots because Windows Explorer is horrible.

This is how the folder structure must be:

C:\Users\Adam\Documents\Arduino
|_libraries
   |_arduino-mqtt-master
      |_library.properties
      |_src, etc.

Is that the folder structure you have?

Note that the library must be directly under C:\Users\Adam\Documents\Arduino\libraries\arduino-mqtt-master. It can't be in a subfolder like this:

C:\Users\Adam\Documents\Arduino
|_libraries
   |_arduino-mqtt-master
      |_arduino-mqtt-master
         |_library.properties
         |_src, etc.


pert

Ah, I see it now in the screenshot of #4. I use Windows mainly but I've managed to beat my Windows Explorer into a semi-acceptable form from the terrible default settings through hours of struggle and registry hacks so I'm not used to deciphering useful information from the stock Explorer's nightmare interface.

Go Up