c - 'sizeof' 对不完整类型问题的无效应用

标签 c sizeof

我得到的错误是

“sizeof”对不完整类型“TProgmemRGBGradientPalette_byte* const [] {aka const unsigned char* const []}”的无效应用

在线 46 https://pastebin.com/xhVEnqts .

下面最后一行是第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 );

最佳答案

它外部变量具有未知的编译时间大小。如果你找不到大小,看代码编译器也不会好

关于c - 'sizeof' 对不完整类型问题的无效应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52214551/

相关文章:

java - 压缩算法(例如 gzip、zip 或 snappy)的输出是否肯定小于输入?

c++ - 有没有办法通过类型单独获取 vector 的字节大小?

c++ - 没有新成员的模板化多态派生类的大小

c - 保存数组会导致 c 中的空文件

c - 未知的 CMake 命令 ADD_TESH_FACTORIES

android - Android 上的 pthread_create 警告

c++ - 在函数调用中调用 sizeof 会跳过实际调用函数!}

c - 为什么这个 sizeof(c+a) 给出 4 个字节而不是 3 个字节

c - 什么决定了整数的大小?

c++ - 如何访问计算机的 RAM 和 ROM 的所有字节?