what can i do with this errors?please help me!

>#ifndef WS2811_h
>#define WS2811_h
>#include <avr/io.h>
>#include <util/delay.h>
>#include <WS2811.h>

Error 1 unterminated #ifndef

>typedef struct __attribute__ ((__packed__)) {
>     uint8_t r;
>    uint8_t g;
>    uint8_t b;
>} RGB_t;

Error 2 expected ':', ',', ';', '}' or 'attribute' before 'r'

2 Years
Discussion Span
Last Post by sepp2k

Since this is a question about C, rather than C++, you should have posted it in te C forum. The two languages are distinct, despite their close relationship. I expect one of the moderators will move it for you.

The first error is simple: whenever you use #if, #ifdef, or #ifndef, you need to follow it with an #endif at some point later in the file to close the conditional. Since this appears to be a header #include guard, you would presumably put it at the end of the source code.

As for the second error my question to you would be, what compiler are you using? The __attribute__ syntax is specific to the GCC compiler, so if you are using a different one, the code would need to be altered to match the compiler you are using.


I think the problem is that it does not recognize uint8_t as a type name because the stdint.h header was not included. That would explain why the error happens "before 'r'", rather than on line 1 (also I believe that (AVR-)GCC is the only compiler that you can use to compile for AVR, so that would probably not be the issue).

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.