I hope I explain this correctly.
Every time I get a new Arduino update, I unzip the new version in a new directory. I have directories named C:Arduino 1.6.11, C:Arduino 1.8.5, and C:Arduino 1.8.9. Each time I get a newer version, there is a new subdirectory in each of these directories.
So, Lets say I make a sketch using the Arduino 1.6.11 version and install some extra libraries in the library directory under 1.6.11, then if I decide to use the updated version say 1.8.5, I would have to (re)install the custom library in the library directory under the 1.8.5 directory. Put another way, there is a different library for each new version of Arduino.
I see that I have a directory called C:Sketches. In this directory is another library file. So I guess that the Arduino compiler looks first at the library associated with the version that you are using, and then looks in the library where the sketches are.
The problem I was having is because my file>preferences said my sketches were in C:Sketches when in fact the skecth I was working with was in a different directory called say C:XSketches and when I added a library the library file went into the C:sketches directory rather than into my C:XSketch directory where my ini file was located.
So, the solution is to make sure that file>preferences points to the directory where the ino file that you are using is located.
I think I understand now.