0

I am trying to use the C library from jgraff (https://github.com/jgarff/rpi_ws281x) in a C++ project. When using the library compiled examples the string works perfectly but within my C++ project the code doesn't compile.

First I was running the the same problem as described here: Initializing typedef struct from C library properly in C++

I am still on my way to learn C++ but this struct is beyond my understanding and therefore I just copied the code over and get now the following errors.

error : braces around scalar initializer for type ‘int’

Then I stripped the initialization of the struct to the following:

ws2811_t ledstring =
{
 nullptr,
 TARGET_FREQ,
 DMA,

 GPIO_PIN, 0, LED_COUNT, 255 

};

And now I am getting the following error:

error: invalid conversion from ‘int’ to ‘const rpi_hw_t*’

Please can anybody advice what's wrong?

Community
  • 1
  • 1
Stefan
  • 35
  • 5

1 Answers1

0

Using the -fpermissive option with g++ treats this error as warning and the code compiles well.

Stefan
  • 35
  • 5