SSD-1306 example won't compile

I'm working on a project that uses a .94 OLED. I need the library Adafruit SSD1306. I have been working on this for over a week. I can't get any of the 5 examples to compile. I have tried clearing everything that relates to that library from all of my drives, downloaded the library from github numerous times just to make sure something isn't corrupted. I've tried using the zip library manager and also doing it manually. Here's a screenshot of where it is located.

All of the other example sketches work just fine. I have a windows 10, I tried it yesterday on my windows 8 computer. Everything worked as it should and I successfully uploaded it to a Nano.

I get this error message. There are more than this but all reference Adafruit_SSD1306.cpp

Arduino: 1.8.8 (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:3:4: error: stray '@' in program

  * @file Adafruit_SSD1306.cpp

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:5:4: error: stray '@' in program

  * @mainpage Arduino library for monochrome OLEDs based on SSD1306 drivers.

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:7:4: error: stray '@' in program

  * @section intro_sec Introduction

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:9:38: warning: missing terminating ' character

  * This is documentation for Adafruit's SSD1306 library for monochrome

                                      ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:9:2: error: missing terminating ' character

  * This is documentation for Adafruit's SSD1306 library for monochrome

  ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:15:4: warning: character constant too long for its type

  * 'bitbang' software SPI are both supported.

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:21:4: error: stray '@' in program

  * @section dependencies Dependencies

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:27:4: error: stray '@' in program

  * @section author Author

    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:32:4: error: stray '@' in program

  * @section license License

    ^


C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:120:59: error: 'int8_t' has not been declared

   Adafruit_SSD1306(uint8_t w, uint8_t h, int8_t mosi_pin, int8_t sclk_pin,

                                                           ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:121:5: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);

     ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:121:20: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);

                    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:121:36: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);

                                    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:123:5: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL);

     ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:123:20: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL);

                    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:123:36: error: 'int8_t' has not been declared

     int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL);

                                    ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:126:27: error: expected ')' before 'mosi_pin'

   Adafruit_SSD1306(int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin,

                           ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:128:27: error: expected ')' before 'dc_pin'

   Adafruit_SSD1306(int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);

                           ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:129:27: error: expected ')' before 'rst_pin'

   Adafruit_SSD1306(int8_t rst_pin = -1);

                           ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:164:3: error: 'int8_t' does not name a type

   int8_t       i2caddr, vccstate, page_end;

   ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.h:165:3: error: 'int8_t' does not name a type

   int8_t       mosiPin    ,  clkPin    ,  dcPin    ,  csPin, rstPin;

   ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:168:3: error: 'int8_t' has not been declared

   int8_t rst_pin, uint32_t clkDuring, uint32_t clkAfter) :

   ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp: In constructor 'Adafruit_SSD1306::Adafruit_SSD1306(uint8_t, uint8_t, TwoWire*, int, uint32_t, uint32_t)':

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:170:3: error: class 'Adafruit_SSD1306' does not have any field named 'mosiPin'

   mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1), rstPin(rst_pin),

   ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:170:16: error: class 'Adafruit_SSD1306' does not have any field named 'clkPin'

   mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1), rstPin(rst_pin),

                ^

C:\Users\Richard W Bruner\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:170:28: error: class 'Adafruit_SSD1306' does not have any field named 'dcPin'

   mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1), rstPin(rst_pin),

                            ^


 

exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It looks to me like it isn't finding or reading the "Adafruit_SSD1306.cpp" file. I have verified that that file contains information.

I'm sure this is a problem with MY computer, I just don't know where else to look.

(deleted)

Here is the code, it is one of the 5 examples that comes with the Adafruit_SSD1306 library. As I stated I don’t think the problem is with the code, it works fine on another computer.

I have included two files “example code” is the one that won’t compile “error code” is the complete error message. I can supply the verbose message if it will help.

Thank you.

error_code.txt (31.2 KB)

example_code.txt (11.2 KB)

The file “Adafruit_SSD1306.cpp” has been corrupted, the first characters in the file are supposed to be a C comment operator, the “/*” sequence which is no longer there.

It might be a simple edit but I’d recommend you just download a fresh copy of the library from github:

I would seriously NOT advise downloading from GitHub.

Use the IDE Library Manager.

Adafruit have been making changes recently. It is wise to upgrade versions as suggested by the Library Manager. Or stick with compatible versions of Adafruit_GFX and Adafruit_SSD1306.

David.

My bad, that error was a left over from a previous time, I missed putting in the “*/”. I updated the library through The Library Manager and still get the errors in attached file. Which is the same as before without all of the"@" errors.

new error message.txt (14.4 KB)

I upgraded my libraries and built "ssd1306_128x64_i2c" for a Nano (Old Bootloader)

Using library SPI at version 1.0 in folder: C:\Program Files\Arduino-1.8.8\hardware\arduino\avr\libraries\SPI 
Using library Wire at version 1.0 in folder: C:\Program Files\Arduino-1.8.8\hardware\arduino\avr\libraries\Wire 
Using library Adafruit_GFX_Library at version 1.3.6 in folder: C:\Users\David\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_SSD1306 at version 1.2.9 in folder: C:\Users\David\Documents\Arduino\libraries\Adafruit_SSD1306 
"C:\\Program Files\\Arduino-1.8.8\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\David\\AppData\\Local\\Temp\\arduino_build_544281/ssd1306_128x64_i2c.ino.elf"
Sketch uses 20718 bytes (67%) of program storage space. Maximum is 30720 bytes.
Global variables use 519 bytes (25%) of dynamic memory, leaving 1529 bytes for local variables. Maximum is 2048 bytes.

It built without error for Uno and Nano. The only real difference between Uno and Nano is the size of the bootloader. i.e. the Nano wastes a lot of flash.

It is wise to enable verbose build via Preferences. It reports the library locations and versions.

David.

As I've said before, I know the code works, it works on one of my other computers. I'm trying to figure out why it don't work on THIS computer. I tried taking all of the files that work on the other computer and putting them in this computer and end up with the same errors.

I finally got it to work. Uninstalled Arduino then deleted the Arduino15 file. Then reinstalled Arduino and installed the librarys using library manager.