Gravity: I2C IP68 Waterproof Ambient Light Sensor (1-65535lx)

/Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h: In function 'uint8_t readReg(uint8_t, const void*, size_t)':
/Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
     uint8_t requestFrom(int, int);
             ^~~~~~~~~~~
/Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
     uint8_t requestFrom(uint8_t, uint8_t);

I have error using Gravity: I2C IP68 Waterproof Ambient Light Sensor.
This is my code

#include "Wire.h"
#define address 0x23                 //I2C address 0x23
void setup()
{
  Serial.begin(9600);
  Wire.begin();
}
uint8_t buf[4] = {0};
uint16_t data, data1;
float Lux;
void loop()
{
  readReg(0x10, buf, 2);              //Register address 0x10
  data = buf[0] << 8 | buf[1];
  Lux = (((float)data )/1.2);
  Serial.print("LUX:");
  Serial.print(Lux);
  Serial.print("lx");
  Serial.print("\n");
  delay(500);
}
uint8_t readReg(uint8_t reg, const void* pBuf, size_t size)
{
  if (pBuf == NULL) {
    Serial.println("pBuf ERROR!! : null pointer");
  }
  uint8_t * _pBuf = (uint8_t *)pBuf;
  Wire.beginTransmission(address);
  Wire.write(&reg, 1);
  if ( Wire.endTransmission() != 0) {
    return 0;
  }
  delay(20);
  Wire.requestFrom(address, (uint8_t) size);
  for (uint16_t i = 0; i < size; i++) {
    _pBuf[i] = Wire.read();
  }
  return size;
};

Welcome to the forum

You started a topic in the Uncategorised category of the forum when its description explicitly tells you not to

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

Which Arduino are you using?
I can compile your program OK with no errors

I use arduino mega 2560

Does it say exit status 1 at the end or does it say something like;

Sketch uses 6484 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 426 bytes (5%) of dynamic memory, leaving 7766 bytes for local variables. Maximum is 8192 bytes.

exit status 1

Compilation error: expected declaration before '}' token

I do not get that error with the code you posted.
Copy the code you posted to a new sketch and try it.

I did it but still error. can I know your arduino ide version?

Maybe I must install library?

There is a semicolon right at the end after the last } delete it

return size;
};

Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^~~~~~~~~~~
/Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);

this is my error

No, your error is :
Compilation error: expected declaration before '}' token

did you delete the semicolon ; ?

Yes, I did delete the semicolon and } in the end.
then the error like this

Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int) uint8_t requestFrom(int, int); ^~~~~~~~~~~ /Users/syafeikarim/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t) uint8_t requestFrom(uint8_t, uint8_t);

I used 1.8.13, no errors compiles OK
I used 2.0.3 compiles OK and shows the candidate 1, 2 BUT they are NOT errors!

In file included from C:\Temp.arduinoIDE-unsaved2024617-7212-1ix97q4.vxg2\sketch_jul17a\sketch_jul17a.ino:2:0:
C:\Users\MAIN\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h: In function 'uint8_t readReg(uint8_t, const void*, size_t)':
C:\Users\MAIN\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^~~~~~~~~~~
C:\Users\MAIN\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^~~~~~~~~~~
Sketch uses 6540 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 430 bytes (5%) of dynamic memory, leaving 7762 bytes for local variables. Maximum is 8192 bytes.

Just like @jim-p, I can successfully compile your sketch for a Mega (IDE 1.8.19). And the warnings disappear if I change #define address 0x23 to const uint8_t address = 0x23;; this however does not mean that the 'exit status 1' will disappear for you.

Please enable verbose output during compilation in file/preferences. Do a verify/compile and post the full results here if it fails (using code tags).

Which version of the IDE?