getting error invalid application of 'sizeof' to incomplete type 'uint8_t []

I am getting this error while compiling the code that uses the EtherCard Library:

invalid application of ‘sizeof’ to incomplete type ‘uint8_t {aka unsigned char }’

at line : if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)

however the same line in different code compiles fine.

#include <EtherCard.h>
#include "Dewpnt_heatIndx.h"

#include<dht.h>
dht DHT;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
static byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
static byte myip[] = { 192, 168, 1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 8900 is default for HTTP):

String rainMsg;

// ///////////// PIN Setup /////////////////
int solenoidPin = 6;    // D6 : This is the output pin on the Arduino we are using
#define DHT11_PIN 8 // D8 to 2nd pin on DHT, leave 3rd pin unconnected 4th is gnd

int rainsense = 2; // analog sensor input pin A2
int buzzerout = 2; // digital output pin D2 - buzzer output
int countval = 0; // counter value starting from 0 and goes up by 1 every second


int GLED = 5; // Wet Indicator at Digital PIN D5
int RLED = 9; // Dry Indicator at Digital PIN D9
int SENSE = 1; // Soil Sensor input at Analog PIN A1
int val = 0;

int greenLedPin = 2; // LED on pin 2
int yellowLedPin = 3;
int redLedPin = 4;

int lightSensorPin = A0;
int analogValue = 0;

double tempInC;
int humidity;
float dP; // dew point
float dPF; // dew point in fahrenheit
float tF; // temperature in fahrenheit

double hIinFah;
double hIinCel;

void setup() {
  // start the Ethernet connection and the server:
  if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
    Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, 8900);

  pinMode(solenoidPin, OUTPUT); // Sets the pin as an output
  pinMode(buzzerout, OUTPUT);
  pinMode(rainsense, INPUT);


  pinMode(greenLedPin, OUTPUT); // LED on pin 2
  pinMode(yellowLedPin, OUTPUT);
  pinMode(redLedPin, OUTPUT);

  pinMode(GLED, OUTPUT);
  pinMode(RLED, OUTPUT);
}

https://www.arduino.cc/en/Reference/Sizeof

however the same line in different code compiles fine

Please post the code in which the line compiles OK

UKHeliBob:

however the same line in different code compiles fine

Please post the code in which the line compiles OK

// This is a demo of the RBBB running as webserver with the Ether Card
// 2010-05-28 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,1,203 };

byte Ethernet::buffer[500];
BufferFiller bfill;

void setup () {
  if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
    Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip);
}

static word homePage() {
  long t = millis() / 1000;
  word h = t / 3600;
  byte m = (t / 60) % 60;
  byte s = t % 60;
  bfill = ether.tcpOffset();
  bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "<!--meta http-equiv='refresh' content='1'/-->"
    "<title>RBBB server</title>" 
    "<h1>$D$D:$D$D:$D$D</h1>"),
      h/10, h%10, m/10, m%10, s/10, s%10);
  return bfill.position();
}

void loop () {
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  
  if (pos)  // check if valid tcp data is received
    ether.httpServerReply(homePage()); // send web page data
}

One of the sketches contains this line, the other one does not.
Guess which one compiles. :wink:

byte Ethernet::buffer[500];