i2c ssd1306 cpp driver

Hi,

I am looking for a library for my ssd1306 oled and I found this one : https://github.com/AndrewFromMelbourne/libSSD1306

I am trying to integrate it in jetson-inference project : https://github.com/dusty-nv/jetson-inference

There is a lot of CMakeFileList and it’s pretty tough for me to declare it well.
So I just changed 2 lines in the CMakeLists.txt:

# build library
file(GLOB jetsonUtilitySources *.cpp camera/*.cpp codec/*.cpp cuda/*.cu display/*.cpp image/*.cpp input/*.cpp network/*.cpp threads/*.cpp i2c/*.cxx)
file(GLOB jetsonUtilityIncludes *.h camera/*.h codec/*.h cuda/*.h display/*.h image/*.h input/*.h network/*.h threads/*.h i2c/*.h)

Unfortunately I have compilation issue because of conflicting global variable:

OledPixel.h:52:1: error: expected identifier before numeric constant

which correspond to :

enum class PixelStyle
{
    Set,
    Unset,
    Xor,
    None,
};

Apparently None is already declared somewhere. I don’t really know how to fix it.
I tried something like:

struct PixelStyle
{
    enum myEnum
    {
Set,
Unset,
Xor,
None,
    };
};

It doesn’t seem to do the trick since I have other errors instead:

OledPixel.cxx:43:41: error: too many initializers for ‘SSD1306::PixelStyle’
PixelStyle opposite{PixelStyle::None};

I am not an expert in c++ though.

Thanks

it is indeed a gcc issue.

the best way to correct it, perhaps is to change “None” to something else, such as “None_0”.

you need to revise all the codes using this, sometime it is not easy.

That’s the last thing I wanted to do. I will give it try ty.

Btw it’s g++ cxx files are c++.