Exit Status 1: " " was not declared in this scope

So I am trying to edit up some code for an OPC-N2 and a DHT humidity sensor.
I had some working code for both and am bringing them together, however a part of the code that was running fine is now returning this error message:
exit status 1
'PowerOn' was not declared in this scope

I'm not sure what has changed... Maybe I am missing something but scrolling between the code that is working and the slightly edited one, there is no difference with the OPC power section of the code.

Will attach section that is broken here:

 void setup() {
 
//This will power on the OPC and allow enough time for fan and laser to reach optimum power
 boolean OPCPowerResult;
 
 Serial.begin(9600); 
 SPI.begin();
 pinMode(SSPin, OUTPUT);
 pinMode(OPCInput, INPUT);

 //setup and add header to the output file on the sd card
 SD.begin(4);
 File myFile = SD.open("file_1.txt", FILE_WRITE);
 myFile.println("#Alphasense OPC-N2 PM Data and bin data averaged over a 1 minute period");
 myFile.println("#Seconds since power on[s],PM1[ug/m^3],PM2.5[ug/m^3],PM10[ug/m^3],Bin0,Bin1,Bin2,Bin3,Bin4,Bin5,Bin6,Bin7,Bin8,Bin9,Bin10,Bin11,Bin12,Bin13,Bin14,Bin15");
 myFile.println("#The bin's are counts of the size of particle detected, see OPC-N2 manual for more details on particle sizes recorded in these");
 myFile.println("#This code was produced by R.Pound as part of summer placement in 2016");
 myFile.close();
 delay(5000);

 //attempt to set the OPC to power on mode 
OPCPowerResult=PowerOn();
   if (OPCPowerResult != true){
   delay(1000); //allow additional time for the OPC before attempting comminication again
   OPCPowerResult = PowerOn();
   if (OPCPowerResult != true){
     delay(70000); //allow the OPC to reset and then attempt connection again
     OPCPowerResult = PowerOn();
     if (OPCPowerResult != true){
       Serial.println("NEED POWER CYCLE");    
     }
   }
 }
  
 //allow time for the fan and laser to reach full power
 delay(6000);

'PowerOn' was not declared in this scope

In the code you posted, where IS PowerOn defined?

//attempt to set the OPC to power on mode 
OPCPowerResult=PowerOn();
   if (OPCPowerResult != true){
   delay(1000); //allow additional time for the OPC before attempting comminication again
   OPCPowerResult = PowerOn();
   if (OPCPowerResult != true){
     delay(70000); //allow the OPC to reset and then attempt connection again
     OPCPowerResult = PowerOn();
     if (OPCPowerResult != true){
       Serial.println("NEED POWER CYCLE");    
     }
   }
 }

Is there any reason you can't simply post the full code?

Learning to quote would be a good idea.

Learning the difference between calling a function and defining a function is absolutely essential.

That isn't a definition.
PowerOn is a function so there must be something in your code or your included libraries that looks like this

boolean PowerOn(){
   //Some code
}

Else you found your problem

PaulS:
In the code you posted, where IS PowerOn defined?

Still unanswered.

Excluding the fact that you included RTCZero.h twice, in the code you posted there is no definition of the function PowerOn().
Maybe you missed it while copying the code from your source projects?
Or maybe you are missing an include statement?

cowellnh:
I cannot attach the entire code as it is longer than 9000 characters.

If the sketch is longer than the 9000 characters maximum allowed by the forum, then it's OK to add it as an attachment. After clicking the "Reply" button, you will see an "Attachments and other settings" link.