void value not ignored as it ought to be PROBLEM

im having that error message when i compile my code. i search for it on internet, it seems like this function returns non-void value and its not accepted. But i really dont understand how it returns.

Any help would be great to figure it out. Thanks in advance for the suggestions

/////***********************/////
void secondPressIsON(){
    bool data2 = false;
    if(wirelessSPI.available()){ 
      while(!data2){
    data2 = wirelessSPI.read(msg2,1);   <<<<<<< HERE İS THE PROBLEM
    if(msg2[0]== 111){
      digitalWrite(LED2,HIGH);
    }
    else{digitalWrite(LED2,LOW);}
}}}

/////***********************/////

and i use it in my main code that way;

void loop()  
{   
  firstPressIsON();
  delay(100);
  secondPressIsON();
  delay(100);
}

    data2 = wirelessSPI.read(msg2,1);  <<<<<<< HERE İS THE PROBLEMThis asks the function to return a value but from the error message it seems that the function is declared void and hence does not return a value.

Without your whole program and a link to the libraries used it is not possible to help further, but possibly the function populates the msg2 variable (probably an array), but that is a guess.

then let me share my whole code which is Receiver code of 1 to 2-3-4-5-6 SPI communication example but first im trying to build it 1 Receiver 2 Transmitter Communication

//***************************Arduino Code for Receiver*******************************
#include <SPI.h> //Call SPI library so you can communicate with the nRF24L01+
#include <nRF24L01.h> //nRF2401 libarary found at https://github.com/tmrh20/RF24/
#include <RF24.h> //nRF2401 libarary found at https://github.com/tmrh20/RF24/

const int pinCE = 9; //This pin is used to set the nRF24 to standby (0) or active mode (1)
const int pinCSN = 10; //This pin is used to tell the nRF24 whether the SPI communication is a command or message to send out
byte daNumber = 0; //The number that the transmitters are trying to guess
RF24 wirelessSPI(pinCE, pinCSN); // Declare object from nRF24 library (Create your wireless SPI) 
const uint64_t rAddress[] = {0xB00B1E50D2LL, 0xB00B1E50C3LL};  //Create pipe addresses for the 2 nodes to recieve data, the "LL" is for LongLong type
const uint64_t wAddress[] = {0xB00B1E50B1LL, 0xB00B1E50A4LL};  //Create pipe addresses for the 2 nodes to transmit data, the "LL" is for LongLong type
int LED1 = 3;
int LED2 = 6;
int msg1[1],msg2[1],msg3[1],msg4[1],msg5[1],msg6[1]; <<<< Arrays that you just mentioned


void setup()   
{
 
  Serial.begin(9600);  //start serial to communication
  wirelessSPI.begin();  //Start the nRF24 module
  wirelessSPI.openReadingPipe(1,rAddress[0]);      //open pipe o for recieving meassages with pipe address
  wirelessSPI.openReadingPipe(2,rAddress[1]);      //open pipe o for recieving meassages with pipe address
  wirelessSPI.startListening();
   pinMode(LED1, OUTPUT);
   pinMode(LED2, OUTPUT);
  
}
void loop()  
{   
  firstPressIsON();
  delay(100);
  secondPressIsON();
  delay(100);
//  thirdPressIsON();
//  delay(100);
//  forthPressIsON();
//  delay(100);
//  fifthPressIsON();
//  delay(100);
//  sixthPressIsON();
//  delay(100);
}

/////***********************/////

void firstPressIsON(){
    bool data1 = false;
    wirelessSPI.startListening();
    if(wirelessSPI.available()){ 
    while(!data1){
    data1 = wirelessSPI.read(msg1,1); <<<<<< Here is the problem
    if(msg1[0]==1){
      digitalWrite(LED1,HIGH);
    }
    else{digitalWrite(LED1,LOW);}
}}
  wirelessSPI.stopListening();
}



/////***********************/////
void secondPressIsON(){
    bool data2 = false;
    wirelessSPI.startListening();
    if(wirelessSPI.available()){ 
      while(!data2){
    data2 = wirelessSPI.read(msg2,1);    <<<<<<< Here is the problem
    if(msg2[0]== 111){
      digitalWrite(LED2,HIGH);
    }
    else{digitalWrite(LED2,LOW);}
}}
  wirelessSPI.stopListening();
}

/////***********************/////

//void thirdPressIsON(void){
//    wirelessSPI.startListening();
//
//
//
//
//    wirelessSPI.stopListening();
//
//  
//}
//
///////***********************/////
//void forthPressIsON(void){
//    wirelessSPI.startListening();
//
//
//
//
//    wirelessSPI.stopListening();
//
//  
//}
//
///////***********************/////
//
//void fifthPressIsON(void){
//    wirelessSPI.startListening();
//
//
//
//    wirelessSPI.stopListening();
//
//}
//
//
//
//
//
//void sixthPressIsON(void){
//    wirelessSPI.startListening();
//
//    wirelessSPI.stopListening();
//
//  
//}

CCEngineering: i search for it on internet, it seems like this function returns non-void value

RF24.h

class RF24 
{
...
  /**
   * Read the available payload
   *
   * The size of data read is the fixed payload size, see getPayloadSize()
   *
   * @note I specifically chose 'void*' as a data type to make it easier
   * for beginners to use.  No casting needed.
   *
   * [b]@note No longer boolean.[/b] Use available to determine if packets are
   * available. Interrupt flags are now cleared during reads instead of
   * when calling available().
   *
   * @param buf Pointer to a buffer where the data should be written
   * @param len Maximum number of bytes to read into the buffer
   *
   * @code
   * if(radio.available()){
   *   radio.read(&data,sizeof(data));
   * }
   * @endcode
   * @return No return value. Use available().
   */
  void read( void* buf, uint8_t len );
void read( void* buf, uint8_t len );

Much as I suspected