stupid library question :'(

so embarrassing ...

Why do i get: shit:8: error: #error ("no Adafruit_SSD1306_H library");

#include <xxxxxxxxxxxxxAdafruit_SSD1306.h>


#ifndef _Adafruit_SSD1306_H_
#error("no _Adafruit_SSD1306_H_ library");
#endif

void setup() {}
void loop() {}

But when i remove that #ifndef i get shit.ino:4:43: fatal error: xxxxxxxxxxxxxAdafruit_SSD1306.h: No such file or directory

#include <xxxxxxxxxxxxxAdafruit_SSD1306.h>

void setup() {}
void loop() {}

?? Already wasting a few hours on this shit.
It seems that my IDE is first compiling the main code and afterwards includes the libraries :frowning:

Of course this gives me the error as well: shit:4: error: #error ("no Adafruit_SSD1306_H library");

#include <Adafruit_SSD1306.h>

#ifndef _Adafruit_SSD1306_H_
#error("no _Adafruit_SSD1306_H_ library");
#endif

void setup() {}
void loop() {}

And for sure i have that library in the libraries folder and it begins with

#ifndef _Adafruit_SSD1306_H_
#define _Adafruit_SSD1306_H_

ideas welcome :cry:

Either the IDE is looking for the library in the wrong places, or you have the library in the wrong place.

jremington:
Either the IDE is looking for the library in the wrong places, or you have the library in the wrong place.

If the IDE were having trouble finding the library, why do i not get a libraryNotFound error:

#include <Adafruit_SSD1306.h>

#ifndef _Adafruit_SSD1306_H_
#error("no _Adafruit_SSD1306_H_ library");
#endif

void setup() {}
void loop() {}

The library was downloaded and installed by the IDE !
But for some strange reason, the #ifndef... ist executed before the #include..

I just tried with this code

#include <Adafruit_SSD1306.h>

#ifndef _Adafruit_SSD1306_H_
#error("no _Adafruit_SSD1306_H_ library");
#endif

void setup() {}
void loop() {}

fully compiled without any issue nor warning. Using 1.6.11 on a mac, with all Libraries up to date. Tried compiling for both a Mega or Uno

robosoft:
But for some strange reason, the #ifndef... ist executed before the #include..

Not possible.

On some versions of the compiler, (which varies depending on IDE version) there is the possibility that the compiler keeps going after it fails to find a #include
In fact on a few versions of gcc, not finding an include was not considered an error or even a warning.
I have always thought that was a REALLY dumb idea and obviously others did as well since that behavior
didn't last but a very short period of time.
But on many versions, the compiler keeps going a bit more so you can potentially get errors for both.

You have not included all the messages emitted from the build process, so it is not possible to say what is happening.
Also, it useful to turn on all the warnings, so you can see more information.

I'd recommend turning on all the warnings, and if the issue is not obvious, then post all the information that is emitted from the build so we can see everything.

--- bill

It's saying no library because that's the error message the code is saying to give. You could just as well simply change that text to "ApplesauceCrocodilePeanutLamp" and that's what it would say the error is.

And what's with all of the xxxxxxxxxxxxxx garbage?

Thank you jML. So it is NOT a coding mistake. I compiled for the ESP8266. But same error for Uno or Mega.

Where can i turn on all warnings ? Where is the log of the build process ?

In the black console like output below i only get

Build-Optionen wurden verändert, alles wird neu kompiliert
shit:4: error: #error ("no _Adafruit_SSD1306_H_ library");

 #error("no _Adafruit_SSD1306_H_ library");

  ^

exit status 1
#error ("no _Adafruit_SSD1306_H_ library");

arduinobug.jpg

INTP:
It's saying no library because that's the error message the code is saying to give. You could just as well simply change that text to "ApplesauceCrocodilePeanutLamp" and that's what it would say the error is.

I think he gets that.

INTP:
And what's with all of the xxxxxxxxxxxxxx garbage?

I think he was trying to explore if he gets an error message or not with a garbage library name or with the real library name.

Do you have any reason not to move to 1.6.11 ?

Do you have any reason not to move to 1.6.11 ?

Falling asleep and have a limited data plan. And i detest this "just re-install" - all this waste of hours and hours and hours :-/

This code works:

#include <Adafruit_SSD1306.h>

void setup() {}
void loop() {}

When i empty the entire Adafruit_SSD1306.h i get a whole bunch of errors because the .cpp file still gets compiled.
When i empty both files, no error.
So the IDE definitely knows where to find the lib.

Still the library is not parsed first:
46171300e71ae5ac4badd4bd49854a4368a755dd.jpg

Now v1.6.11 and IS working :-/

But the holy shit continues.
For the ESP8266 i have to modify the library to add the I2C pins...
Can anybody explain me why the error occurs at the second of the two identical lines ?
(Of course the error occurs with just one line as well, even so the .h and .cpp files are correct.)
See attached screenshot.

Okay, somehow the compiler succeeded.
Still, what a shitty IDE: Even so the .h file defines Adafruit_SSD1306(int8_t RST = -1);

// this works
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET); 

// this throws that strange error above:
#define OLED_RESET -1
Adafruit_SSD1306 display();

I am a programmer since the days of the C64, even invented three programming languages myself.
Oh so many times i wish, opensource would never have born.

robosoft:
Oh so many times i wish, opensource would never have born.

Really?
Open source has made possible so much of the technology that is currently in wide spread use today.
It has had a much bigger impact than anything that is closed source.

Without open source there would be no BSD unix which came from "stealing" ATT unix through a bad licensing agreement.
There would be no BSD unix, which is the basis of Apples' MACOS and IOS.
No gcc or gnu tools which was the basis for MANY projects/products.
UNIX and gcc was used to develop the code for Microsoft NT.
Linux was essentially modelled after seeing the code and documentation for UNIX.
And without linux there would be no Android.
And linux is the basis for most routers out there.

So lets see without open source, there would be no BSD unix, no gcc, no Microsoft NT, no MACOS, no IOS, no linux, no adroid, most routers would not have s/w, many embedded internet cameras wouldn’t have code, likewise many DVRs, and a variety or interconnected embedded devices.
Not to mention nearly half of all the worlds web servers today are running linux.
The percent goes much higher if you toss in the all the sites running open source apache web server code.

That is a pretty big impact.
And that is just some of the larger products/projects that use open source.

Imagine a world if you took away all the open source and all the products that were developed using open source tools. That would remove pretty much all existing smart phones, most routers, most IP cameras, many hand held GPS devices, DVRs, Microsoft NT, MACOS, IOS, and half of the worlds web servers. All that literally goes away without open source.

Not something that I'd ever wish for.

And then walk the clock back to the early days of Apple.
The original Apple ][ back in the late 70's was all open source.
Apple published the schematics to the motherboard, and the listings to the ROMs.
When IBM created their first PC, they followed in those footsteps and also published their schematics, and their ROM listings.
Because IBM published the schematics and ROM listings, it allowed the PC clone business to originate.
The PC market would have never taken off without the ability of the clone makers to create equivalent h/w that could run the same s/w.
And all that is because of open source.

--- bill

@bperrybap
Great reply, K++

robosoft:
Okay, somehow the compiler succeeded.
Still, what a shitty IDE: Even so the .h file defines Adafruit_SSD1306(int8_t RST = -1);

// this works

#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);

// this throws that strange error above:
#define OLED_RESET -1
Adafruit_SSD1306 display();



I am a programmer since the days of the C64, even invented three programming languages myself.
Oh so many times i wish, opensource would never have born.

We all can understand frustration when working on a seemingly unrealistic bug.

You seem to understand programming, you could drop the IDE, use the command lines to compile - even if the compilers are open source as well, hope you don't mind :slight_smile:

Glad to see that 1.6.11 helped. It is usually a good practice to stay current. If you are a programmer, you know about bugs, and that new releases often fix bugs...

Also When you face a bug go see the source code of the library. I'll try what you said later.

tested this code

#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET); 


void setup() {}
void loop() {}

and

#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
Adafruit_SSD1306 display(); 


void setup() {}
void loop() {}

and this code

#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(); 


void setup() {}
void loop() {}

the 3 compile fine on my mac with IDE as described above and most recent libraries. No warning, no error.

(that being said, it's possible that the compiler just does not even care because I don't use display so possibly just get rid of the code; I did not check that)

bperrybap:
Imagine a world if you took away all the open source ...Not something that I'd ever wish for.

And anyone really thought that i did not already expected that answer which i waited for because it proves what i said.

Opensource has become the new religion :frowning:

And with every religion, there is no longer creation because religion only resolves around itself :frowning:
proof: believers really think that without Linux there would not have been anything else to fill the emptiness (and even perform far better). Linux only conquered the world because it's for free. Not because it hails object oriented programming - on every level.

Let us not fight no this. As the Jehovah's Witness always conclude: "But the bible says.."

Yesterday i wanted to connect an ESP8266 to three I2C devices in row: DIO, ADC and OLED. With a perfect build environment this would have taken 20 minutes. After nearly 10 hours with 90% frustration i at least succeeded with the 8x relay example code.

And for every little error google can show you hundreds of search results, we all know that ! Millions of man-hours wasted !!!

Within the last 15 years programming has turned into "try and error".
I will try so many libraries and tutorials until for some strange reason one will work.
That is the legacy of Linux. A world ruled by amateur programmers who hail themselves because they can not and never wanted to see beyond their new kingdom.

No way to evade that: When everyone eats shit you have to eat shit too.

I liked the Arduino IDE because it looks so simple (not like that crappy Android Studio).
So I dreamed that you would show me making a stupid mistake.
Yet even if i did so, the IDE should not have allowed for that..

thanks anyway :slight_smile:
the Roland, www.anderDine.com and www.scriptdoctors.org

and of course this forum software is Opensource too. So why can't i quickly correct a broken link: You have exceeded the number of posts you can make in a 5 minutes period. Please try again later.

In the Opensource world nothing really works perfectly. The Roland and www.angerDine.com

yes - sometimes it's a pain and we loose hours when there is a bug in something we did not write... and sometimes we create the bug too...

you can go on a long rant about open source or not. Fact is that if you don't like what's offered, don't use it... code your full things yourself or don't code and go enjoy a nice hike outside.

No need to complain, no one forces you to use it - like no one forces the community here to help answer angry questions from frustrated developers :slight_smile: (we have all been there, so I think many of us understand the frustration)

take it easy. it's an imperfect world. if your PC version of the environment don't deal well with

Adafruit_SSD1306 display();

then don't do it. just do what works

Adafruit_SSD1306 display(-1);

and move on.