Can't compile the Maker Kit Tutorial #2: Next Bus Alert

First time poster!

I’m having trouble compiling the code for the Next Bus Alert example.

Whether I copy/paste the example from the tutorial, or use example provided via the IDE.

I do have the library installed:
Adafruit_SSD1306 (0.0.2)

The raw script that is dying is:

DEPENDENCY=4,2,108 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o ../build/target/user/platform-6-msrc/dabus.o src/dabus.cpp
dabus.ino:17:1: error: 'Adafruit_SSD1306' does not name a type
dabus.ino: In function 'void setup()':
dabus.ino:46:3: error: 'display' was not declared in this scope
dabus.ino:46:17: error: 'SSD1306_SWITCHCAPVCC' was not declared in this scope
dabus.ino:49:24: error: 'WHITE' was not declared in this scope
dabus.ino: In function 'void loop()':
dabus.ino:58:3: error: 'display' was not declared in this scope
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/stdio.h:35:0,
                 from ./inc/application.h:84,
                 from src/dabus.cpp:1:
dabus.ino: In function 'String tryExtractString(int, String, const char*, const char*)':
dabus.ino:108:16: error: converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
dabus.ino:108:16: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
dabus.ino:126:1: warning: control reaches end of non-void function [-Wreturn-type]
../build/ recipe for target '../build/target/user/platform-6-msrc/dabus.o' failed
make[2]: *** [../build/target/user/platform-6-msrc/dabus.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/ recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/photon/user-part'
../build/ recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

There was another issue in the forum about this, which seemed to be related to 0.6.1… but I’m on 0.6.2.

Can anyone help?

Code is here:


My bad.


Can you also post a link to your project?
This can be done in Web IDE via the SHARE THIS REVISION button.

A while back there was a “rework” of the String class which now requires this code in the sample

    if (str == NULL) {
        return NULL;

to be changed to this

    if (str == "") {
        return "";

(I have updated the sampe code accordingly)

A version of that sample that builds for me can be found here

Thanks for that!

I have copied the code at that revision - and it works!


However, I did make changes to the string as per your post, and it did not build.

A link to that “no building” app is here:

Not sure what isn’t right with it, that debug messages are not that helpful!

Thanks again!

You just need to get some practice reading those messages. If you look at the the first line that has an error related to your .ino file, you’ll see this line:

dabus.ino:17:1: error: ‘Adafruit_SSD1306’ does not name a type

That would indicate (most likely) that you didn’t import the header file of the library. At the top of your file you should have an include statement like this,

#include "Adafruit_SSD1306.h"

What @Ric said.
When you follow the instructions, you’ll first copy/paste the sample code into your project and save that project.
When you then import the library into the project, the include statement will be added automatically (as mentioned in the project blurb)

If you did that the other way round, copy/pasting may have overwritten the include statement.