Libraries to include - I seem to be missing something

It has been a long time since I have done any coding and now I an trying to update some working code, I am getting an error which I don't understand.

This is the include part of my code:


#include <DHT.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <TinyGPS.h>
#include <TimeLib.h>
#include <Adafruit_BMP085.h>

The first line isn't happy.

Expanded_External_Temperatures_new_5hce:50:17: fatal error: DHT.h: No such file or directory
 #include <DHT.h>

This is the library directory as seen in the terminal:

me@me-desktop:~/Arduino/libraries$ ls
Adafruit_AM2320_sensor_library  ArduinoMorse-master     Centipede           Entropy         IoTtweetESP32      Rotary              Streaming
Adafruit_BME280_Library         arduino-softpwm-master  ClickButton         ESP8266-ping    Keyboard           RotaryEncoder       Time
Adafruit-BMP085                 arduino-toneac-master   DHT                 Etherkit_Morse  LedControl-master  SD                  TinyGPS
Adafruit_Circuit_Playground     BlueDot_BME280_Library  DHT_sensor_library  Ethernet        NewPing            SimpleDHT           WiFiEsp
Adafruit_NeoPixel               Bounce2                 DS3231              Firmata         PubSubClient       SimpleTimer-master
Adafruit_Sensor-master          Bridge                  DS3232RTC           ICMPPing        readme.txt         Sodaq_BMP085
me@me-desktop:~/Arduino/libraries$

I get that there are (kind of) two DHT directories. As I said: It has been a long time.

But both are the same I just named the longer named one to simply DHT.

This is what is in there:

me@me-desktop:~/Arduino/libraries$ cd DHT
me@me-desktop:~/Arduino/libraries/DHT$ ls
DHT.cpp  DHT.h  DHT_U.cpp  DHT_U.h  examples  keywords.txt  library.properties  README.md
me@me-desktop:~/Arduino/libraries/DHT$ 

So I guess it should be called DHT and not the longer version.

But.....

I don't understand why I am getting that error.

Someone - please.

Something which may be causing this:
When I ask for the version of the Arduino program it is 1.8.15 - yeah: old.
But I don't know where it has installed itself. I have an arduino directory in my home folder and all code in that directory and any libraries in the libraries directory there.

I would try removing both DHT directories and re-install from the link below ("Code", "Download zip"). Then in IDE: Sketch -> Include Library -> Add zip library.

Your post was MOVED to its current location as it is more suitable.

1 Like

(Shame on me)

Seems I need to use the new path for the libraries: /home/me/snap/arduino/current/Arduino/libraries
rather than what I was using: /home/me/Arduino/libraries

Sorry. It just seems that with one of the newer releases things got automagically moved to new paths.

Idiots like me who don't know of these tricks got confused by this.
Sorry folks.

From the "snap" in the path, It looks like you used Snap to install Arduino IDE.

Well, that was forced on me when I updated the Ubuntu version.

Originally I installed it from ..... I honestly can't remember.
I think I went to the "store" (what ever it is called in Ubuntu) and installed it from there.

But with a recent update it became part of snap. (Way above me how that works)

So, I'm guessing that I will have to put/move all other libraries I was (am?) using to the newer path to keep things working.

I don't install the Arduino IDE, because the repositories contained very old versions in the past.

First of all, I delete all the Java, JRE, JDK and all those things.
I remove the modemmanager, just because I don't like it.

Then I download the 64-bit linux tar.xz-file from here: https://www.arduino.cc/en/software.
I unpack that in a folder somewhere under my home folder.
I still don't install something, but I make a shortcut to "arduino" and put the shortcut on my desktop.

That way I keep my system as clean as possible, and I can try other versions as long as the preferences.txt file has not changed a lot.

Alas what you say is beyond my skill set.

I've been bitten but things being updated via this snap and now don't work (KODI addons) but reading it is claimed that this is the way of the future - via snap.

Firefox is the same. (Sorry, I'm ranting)

If you can download it from this website and unpack it with a right-mouse-click, then you can run it, by running the 'arduino' file.

Wouldn't that change the path to the libraries again?

When I unpack it, and install it.... How do I set where it installs?
That also had me messed up for a long time. Originally it was in my Downloads directory which is not what I really want/ed.

How would I find the new path to where they now are/were moved to?

It will use the "libraries" in the old location (not the snap). I don't use that default location, I set my own folder in the settings in the Arduino IDE.
Instead of the Downloads folder, you can make any folder that you want. For testing, you can unpack it in the Downloads folder. It can be anywhere.

Remember that they all use the same files in the hidden ".arduino15" folder in your home folder.

By making a shortcut (right-click on the 'arduino' file) and dragging that shortcut on my desktop, I can click that shortcut to start the Arduino IDE.

Do you have the "open terminal here" option installed in the file manager ? If the Arduino IDE is unpacked, then you can open a terminal in that folder and type ./arduino to run the 'arduino' file.

I don't run the *.sh file to install something. I never install something from Arduino. I run it from the unpacked folder, that's all.

For installing packages, I use Synaptic. I have only three 'snap' programs, and also a few downloaded things, such as Arduino.

1 Like

When I am more motivated I shall have to look at this more seriously.

Got a bad case of isolation blues today. :frowning:

We'd better stop now as I marked this as solved and I am not sure this is acceptable - what we are now doing.

This forum is not strict. Useful information is good. Annoying the moderators is bad, but they are friendly, so no worries.
There is even a section for things that are not useful: Bar Sport - Arduino Forum

I need to concentrate on the problem at hand.

It has been a long time since I did much programming on the Arduino.
I now have another language which is keeping me interested.
But I need to get back to Arduino stuff as one talks to the other.

I may start a new thread for that problem though.

I guess you mean "GNOME Software":
https://en.wikipedia.org/wiki/GNOME_Software
(still referred to by its old name "Ubuntu Software")

It offers software from multiple package managers, including Snapcraft, but Arduino does not maintain any official packages for the Arduino IDE. So all Arduino packages you find are the product of some random volunteer maintainer.

The requirements of the package manager may require that volunteer to make some modifications to the IDE, as was the case with APT and Arch package managers (I don't know about Snapcraft).

Sometimes the volunteer maintainer may make some random changes of their own initiative. For example, the snap maintainer threw in the 3rd party dark theme.

The changes made by the package maintainers regularly cause bugs. This makes it difficult for those of us who provide support for the IDE because we will not be familiar with those bugs and won't be able to reproduce them in our official versions of the IDE.

I have never used the Arduino IDE snap, but I don't think that should be necessary.

The IDE looks for libraries in the libraries subfolder of the sketchbook folder. With the official version of the Arduino IDE, the default location of the sketchbook is /home/me/Arduino, where "me' is the user name of the person using the IDE. I'm sure the snap version must also use libraries from the sketchbook, but it might use a different sketchbook location. But the sketchbook location is configurable, so you should be able to change it back to the old location.

I'll provide instructions for doing that:

  1. Start the Arduino IDE
  2. Select File > Preferences from the Arduino IDE menu.
  3. In the "Preferences" dialog that opens, you will see a "Sketchbook location" field. Change it to this:
    /home/me/Arduino
    
  4. Click OK button.
  5. Close all Arduino IDE windows.
  6. Start the Arduino IDE

The libraries from /home/me/Arduino should now be recognized by the IDE.

It isn't quite so bad with Snap as it is with APT, which is stuck with a version 8 years out of date, but the "latest/stable" version of Arduino IDE provided by Snapcraft is 1.8.15, while Arduino IDE 1.8.16 was released over 2 months ago.

This is a problem with relying on a random volunteer maintainer for the package. Volunteers sometimes get busy or bored with a project and don't keep it updated.

I don't bother with that either. It only makes some aesthetic/convenience configurations to your system that I don't care about. I do the same as Koepel to install it, except I don't make the convenience shortcut on the desktop.

You can just double click the file in the file manager. When you get the 'Do you want to run "arduino"' dialog, click the Run button. The IDE will then start up like usual.

As long as the discussion stays on topic to the original subject, there is absolutely no problem continuing discussion.

But I'll confess the discussion of how to install the IDE is probably straying a bit off topic. We can request that a moderator split that part of the discussion into a dedicated topic if we need to continue with it.