Ok, maybe I'm being dense but this statement:
enum command_id:uint8_t {BMI160TELEMETRY = 1, MPU9250TELEMETRY};
Compiles ok in ESP32 arduino but fails when I compile it under ESP-IDF with the following error
C:/msys32/home/gcorson/esp/tcp_server/main/tcp_server.c:31:16: error: expected identifier or '(' before ':' token enum command_id:uint8_t {BMI160TELEMETRY = 1, MPU9250TELEMETRY};
Not clear why this happens, isn't enum's syntax supposed to be
enum [identifier] [: type] {enum-list};
What am I doing wrong?
Stupid enum problem....
Re: Stupid enum problem....
I think the C syntax is
Code: Select all
enum [identifier] {enum-list};
--
Paul.
Paul.
Re: Stupid enum problem....
Hi Greg,
Typed enums are a C++ feature added in C++11.
You will need to either remove the ": uint8_t" part (without this specified type, in both C & C++ the enum values will have the type of int, ie 4 bytes wide not 1 byte wide), or compile this code as C++ not C.
Typed enums are a C++ feature added in C++11.
You will need to either remove the ": uint8_t" part (without this specified type, in both C & C++ the enum values will have the type of int, ie 4 bytes wide not 1 byte wide), or compile this code as C++ not C.
-
- Posts: 35
- Joined: Sun May 20, 2018 9:16 pm
Re: Stupid enum problem....
Knew it was something dumb, just noticed the code was compiling as C and not C++.
Thanks for the tip!
Thanks for the tip!
Who is online
Users browsing this forum: Baidu [Spider], jcolebaker and 148 guests