sparkfun / SparkFun_SSD1320_OLED_Arduino_Library

Display graphics and text on a flexible grayscale display
10 stars 5 forks source link

Multiple definition of 'enum CMD' #6

Closed tnsolley closed 5 years ago

tnsolley commented 5 years ago

Arduino IDE ver. 1.8.8 Compile-for Arduino Nano. Windows 10.

Using

#include <Adafruit_MCP4725.h>
#include <Wire.h>
#include <LIDARLite.h>
#include <SFE_MicroOLED.h>  // Include the SFE_MicroOLED library
#include <SSD1320_OLED.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <Adafruit_BME680.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Users\thomas.solley\Documents\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:71:14: error: multiple definition of 'enum CMD'

 typedef enum CMD {

              ^

Also

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Users\thomas.solley\Documents\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:91:3: error: conflicting declaration 'typedef int commCommand_t'

 } commCommand_t;

   ^
nseidle commented 5 years ago

Hi - Thanks for reporting but I can't replicate.

I just pulled v1.0.4 of lib via lib manager, and compiled for Arduino Nano (ATmega328)

Arduino v1.8.8 Windows 10

So it sounds like we're very close to similar platforms. I'm not sure what the problem is but it's possibly related to your other reported issue.

tnsolley commented 5 years ago

I found from a similar issue with the Picaso_Const4D.h file (and RTClib.h) that I suspect both libraries, SSD1320_OLED.h and SFE_MicroOLED.h, having this naming conflict because they use the same variable. I found with the 4Duino system that changing one's use of OFF and ON to OFF4D and ON4D fixed that; I suspect something similar needs to happen here, though I'm in no position to suggest which library does what...

nseidle commented 5 years ago

Thanks for coming back to describe a fix. According to your original post, the conflict was with this line. But the SparkFun typedef enum CMD does not contain ON or OFF so are you describing a new issue?

One way to avoid your original issue is to change our CMD to SSD1320_CMD.

tnsolley commented 5 years ago

@nseidle Sorry, I didn't clarify well enough. I assumed that the use of CMD was conflicting between SSD1320_OLED.h and SFE_MicroOLED.h; I'm actually no longer sure that's the case. After posting, I did a bit of tinkering; looking closer at the reported problem (Arduino IDE feedback, above) I noticed that the files referenced were being pulled from my \User\...\Documents\ folder and not from ...\Program Files (x86)\Arduino\. I've since removed the named libraries folder from Documents and copied all the required libraries to their proper location under \Program Files (x86)\. Sadly the issue didn't go away, in fact it seems to have gotten worse. I am (still) getting another issue, but that appears to be related-to the Qwiic Micro OLED example-function printTitle(), which I'll reference shortly. Not sure if related...

Output after changing SSD1320_OLED.h 'CMD' to SSD1320_CMD:

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

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:72:3: error: redeclaration of 'CMD_CLEAR'

   CMD_CLEAR,      //0

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:106:2: note: previous declaration 'CMD CMD_CLEAR'

  CMD_CLEAR,   //0

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:73:3: error: redeclaration of 'CMD_INVERT'

   CMD_INVERT,     //1

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:107:2: note: previous declaration 'CMD CMD_INVERT'

  CMD_INVERT,   //1

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:74:3: error: redeclaration of 'CMD_CONTRAST'

   CMD_CONTRAST,   //2

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:108:2: note: previous declaration 'CMD CMD_CONTRAST'

  CMD_CONTRAST,  //2

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:75:3: error: redeclaration of 'CMD_DISPLAY'

   CMD_DISPLAY,    //3

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:109:2: note: previous declaration 'CMD CMD_DISPLAY'

  CMD_DISPLAY,  //3

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:76:3: error: redeclaration of 'CMD_SETCURSOR'

   CMD_SETCURSOR,    //4

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:110:2: note: previous declaration 'CMD CMD_SETCURSOR'

  CMD_SETCURSOR,  //4

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:77:3: error: redeclaration of 'CMD_PIXEL'

   CMD_PIXEL,      //5

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:111:2: note: previous declaration 'CMD CMD_PIXEL'

  CMD_PIXEL,   //5

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:78:3: error: redeclaration of 'CMD_LINE'

   CMD_LINE,     //6

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:112:2: note: previous declaration 'CMD CMD_LINE'

  CMD_LINE,   //6

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:79:3: error: redeclaration of 'CMD_LINEH'

   CMD_LINEH,      //7

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:113:2: note: previous declaration 'CMD CMD_LINEH'

  CMD_LINEH,   //7

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:80:3: error: redeclaration of 'CMD_LINEV'

   CMD_LINEV,      //8

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:114:2: note: previous declaration 'CMD CMD_LINEV'

  CMD_LINEV,   //8

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:81:3: error: redeclaration of 'CMD_RECT'

   CMD_RECT,     //9

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:115:2: note: previous declaration 'CMD CMD_RECT'

  CMD_RECT,   //9

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:82:3: error: redeclaration of 'CMD_RECTFILL'

   CMD_RECTFILL,   //10

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:116:2: note: previous declaration 'CMD CMD_RECTFILL'

  CMD_RECTFILL,  //10

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:83:3: error: redeclaration of 'CMD_CIRCLE'

   CMD_CIRCLE,     //11

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:117:2: note: previous declaration 'CMD CMD_CIRCLE'

  CMD_CIRCLE,   //11

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:84:3: error: redeclaration of 'CMD_CIRCLEFILL'

   CMD_CIRCLEFILL,   //12

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:118:2: note: previous declaration 'CMD CMD_CIRCLEFILL'

  CMD_CIRCLEFILL,  //12

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:85:3: error: redeclaration of 'CMD_DRAWCHAR'

   CMD_DRAWCHAR,   //13

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:119:2: note: previous declaration 'CMD CMD_DRAWCHAR'

  CMD_DRAWCHAR,  //13

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:86:3: error: redeclaration of 'CMD_DRAWBITMAP'

   CMD_DRAWBITMAP,   //14

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:120:2: note: previous declaration 'CMD CMD_DRAWBITMAP'

  CMD_DRAWBITMAP,  //14

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:87:3: error: redeclaration of 'CMD_GETLCDWIDTH'

   CMD_GETLCDWIDTH,  //15

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:121:2: note: previous declaration 'CMD CMD_GETLCDWIDTH'

  CMD_GETLCDWIDTH, //15

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:88:3: error: redeclaration of 'CMD_GETLCDHEIGHT'

   CMD_GETLCDHEIGHT, //16

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:122:2: note: previous declaration 'CMD CMD_GETLCDHEIGHT'

  CMD_GETLCDHEIGHT, //16

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:89:3: error: redeclaration of 'CMD_SETCOLOR'

   CMD_SETCOLOR,   //17

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:123:2: note: previous declaration 'CMD CMD_SETCOLOR'

  CMD_SETCOLOR,  //17

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:90:3: error: redeclaration of 'CMD_SETDRAWMODE'

   CMD_SETDRAWMODE   //18

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:124:2: note: previous declaration 'CMD CMD_SETDRAWMODE'

  CMD_SETDRAWMODE  //18

  ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:57:0:

C:\Program Files (x86)\Arduino\libraries\SSD1320_OLED/SSD1320_OLED.h:91:3: error: conflicting declaration 'typedef enum SSD1320_CMD commCommand_t'

 } commCommand_t;

   ^

In file included from H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:56:0:

C:\Program Files (x86)\Arduino\libraries\SFE_MicroOLED/SFE_MicroOLED.h:125:3: note: previous declaration as 'typedef enum CMD commCommand_t'

 } commCommand_t;

   ^

H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino: In function 'void loop()':

H:\Dev\Cosplay_pictures\Legacy_Mando_SWEU\Helmet\sketch_jan21a\sketch_jan21a.ino:92:6: note:   initializing argument 1 of 'void printTitle(String, int)'

 void printTitle(String title, int font)

      ^

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.
tnsolley commented 5 years ago

Renaming the entirety of typedef enum CMD{} seems to have helped, though, in SSD1320_OLED.h --- I no longer get the reported error. TL:DR; Folks using both SSD1320_OLED.h and SFE_MicroOLED.h may need to rename their typedef enum CMD{} and it's contents, as I did for SSD1320_OLED.h;

typedef enum SSD1320_CMD {
  SSD1320_CMD_CLEAR,      //0
  SSD1320_CMD_INVERT,     //1
  SSD1320_CMD_CONTRAST,   //2
  SSD1320_CMD_DISPLAY,    //3
  SSD1320_CMD_SETCURSOR,    //4
  SSD1320_CMD_PIXEL,      //5
  SSD1320_CMD_LINE,     //6
  SSD1320_CMD_LINEH,      //7
  SSD1320_CMD_LINEV,      //8
  SSD1320_CMD_RECT,     //9
  SSD1320_CMD_RECTFILL,   //10
  SSD1320_CMD_CIRCLE,     //11
  SSD1320_CMD_CIRCLEFILL,   //12
  SSD1320_CMD_DRAWCHAR,   //13
  SSD1320_CMD_DRAWBITMAP,   //14
  SSD1320_CMD_GETLCDWIDTH,  //15
  SSD1320_CMD_GETLCDHEIGHT, //16
  SSD1320_CMD_SETCOLOR,   //17
  SSD1320_CMD_SETDRAWMODE   //18
} SSD1320_commCommand_t;