Reputation: 1
Im getting the error of
invalid application of 'sizeof' to incomplete type 'TProgmemRGBGradientPalette_byte* const [] {aka const unsigned char* const []}'
On line 46 https://pastebin.com/xhVEnqts.
The last line below is line 46:
#define FASTLED_ALLOW_INTERRUPTS 0
#include "FastLED.h"
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsClient.h> // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries
#include <ArduinoJson.h> // https://github.com/kakopappa/sinric/wiki/How-to-add-dependency-libraries
#include <StreamString.h>
#define DATA_PIN 3
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
#define NUM_LEDS 30 // Change this to reflect the number of LEDs you have
#define BRIGHTNESS 128 // Set Brightness here
CRGB leds[NUM_LEDS];
#define SECONDS_PER_PALETTE 15
ESP8266WiFiMulti WiFiMulti;
WebSocketsClient webSocket;
WiFiClient client;
#define MyApiKey "xxxx" // TODO: Change to your sinric API Key. Your API Key is displayed on sinric.com dashboard
#define MySSID "xxxxx" // TODO: Change to your Wifi network SSID
#define MyWifiPassword "xxxx" // TODO: Change to your Wifi network password
#define HEARTBEAT_INTERVAL 300000 // 5 Minutes
uint64_t heartbeatTimestamp = 0;
bool isConnected = false;
void setPowerStateOnServer(String deviceId, String value);
void setTargetTemperatureOnServer(String deviceId, String value, String scale);
extern const TProgmemRGBGradientPalettePtr gGradientPalettes[];
extern const uint8_t gGradientPaletteCount;
uint8_t gCurrentPaletteNumber = 0;
CRGBPalette16 gCurrentPalette( CRGB::Black);
CRGBPalette16 gTargetPalette( gGradientPalettes[0] );
const uint8_t gGradientPaletteCount =
sizeof( gGradientPalettes) / sizeof( TProgmemRGBGradientPalettePtr );
Upvotes: 0
Views: 1652
Reputation: 26800
An array type is an incomplete type if its size is not present, and sizeof
cannot be applied on an incomplete type.
The following line means that the definition of gGradientPalettes
is present in some other file.
extern const TProgmemRGBGradientPalettePtr gGradientPalettes[];
The compiler is not able to find this definition and so it complains at this line:
const uint8_t gGradientPaletteCount =
sizeof( gGradientPalettes) / sizeof( TProgmemRGBGradientPalettePtr );
Upvotes: 1
Reputation: 67713
It extern variable with unknown compile time size. If you cant find the size looking at the code compiler will not as well
Upvotes: 1