*Solved* I can't seem to get my sketch to compile.

Hello all, I recently my sketch from an uno to a Mega2560 because I was running out of memory when I tried to add a microSD adapter to my project. When I try to compile this sketch, I get a very extensive error ending with: Error compiling for board Arduino/Genuino Mega or Mega 2560. I am confused about the #include<SD.h>, in the text document inside the library is a reference to:

which I went to, and found that it referred to an SDfat library. So I installed it and inserted it into the top of my sketch, and as you will see below added a bunch of other libraries. My sketch is below and the error was copied to a notepad document and is attached. If anyone can suggest anything that may help, I would be very helpful. Thanks
Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
I just found that my post including the coding exceeds the 9000 character limit of this forum. So only the code is attached.

ATS-Emon_3.3.txt (12.4 KB)

My error

11-14-2019_Arduino_error.txt (36.4 KB)

The error output from sdingman's 11-14-2019_Arduino_error.txt:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:23:0: warning: "FILE_READ" redefined

 #define FILE_READ O_READ

 

In file included from C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:27:0,

                 from C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/SdFat.h:33,

                 from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:4:

C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FatLib/ArduinoFiles.h:37:0: note: this is the location of the previous definition

 #define FILE_READ O_RDONLY

 

In file included from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:38:0:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:24:0: warning: "FILE_WRITE" redefined

 #define FILE_WRITE (O_READ | O_WRITE | O_CREAT | O_APPEND)

 

In file included from C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:27:0,

                 from C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/SdFat.h:33,

                 from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:4:

C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FatLib/ArduinoFiles.h:39:0: note: this is the location of the previous definition

 #define FILE_WRITE (O_RDWR | O_CREAT | O_AT_END)

 

In file included from C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:21:0,

                 from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:38:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/utility/SdFatUtil.h: In function 'int FreeRam()':

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/utility/SdFatUtil.h:40:15: warning: type mismatch with previous external decl of 'int __bss_end' [-fpermissive]

   extern int  __bss_end;

               ^~~~~~~~~

In file included from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:2:0:

C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FreeStack.h:35:13: note: previous external decl of 'char __bss_end'

 extern char __bss_end;

             ^~~~~~~~~

In file included from C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:21:0,

                 from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:38:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/utility/SdFatUtil.h:41:15: warning: type mismatch with previous external decl of 'int* __brkval' [-fpermissive]

   extern int* __brkval;

               ^~~~~~~~

In file included from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:2:0:

C:\Users\sdingman\Documents\Arduino\libraries\SdFat\src/FreeStack.h:33:14: note: previous external decl of 'char* __brkval'

 extern char *__brkval;

              ^~~~~~~~

In file included from C:\Users\sdingman\Documents\Arduino\ATS-EMON_3.3\ATS-EMON_3.3.ino:38:0:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h: At global scope:

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:62:3: error: 'SdVolume' does not name a type; did you mean 'FatVolume'?

   SdVolume volume;

   ^~~~~~~~

   FatVolume

C:\Users\sdingman\Documents\Arduino\libraries\SD\src/SD.h:70:33: error: 'SD_CHIP_SELECT_PIN' was not declared in this scope

   boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);

                                 ^~~~~~~~~~~~~~~~~~

sdingman:
I am confused about the #include<SD.h>, in the text document inside the library is a reference to:
http://www.arduino.cc/en/Reference/SD
which I went to, and found that it referred to an SDfat library. So I installed it and inserted it into the top of my sketch

You definitely misinterpreted the information on the SD library reference page. The SD library is a library provided with the Arduino IDE. This is the library that your ATS-EMON_3.3 sketch was written to use, as shown by this line:

#include <SD.h>

SD - Arduino Reference contains the documentation for the SD library. It also contains a credit for the library that the SD library was based on:

It is built on sdfatlib by William Greiman

Very frequently in the world of open source software, programmers will start with some existing code and then modify it to their needs, rather than reinventing the wheel unnecessarily. It is common courtesy to give some recognition for the origins of the project in the documentation. Unfortunately, this seems to have lead you to believe you should install the SDfat library. That is completely incorrect. The SDfat library is an alternative to the Arduino SD library, which has advanced features, but is maybe a bit less user friendly.

sdingman:
So I installed it and inserted it into the top of my sketch

That was not the right thing to do. If you do need to switch from using the SD library to the SDfat library in the sketch, it will likely require you to make some modifications to the code, which will mean you need to understand the current code as well as how to use the SDfat library. It's unclear to me whether this is necessary because you have not provided a description of the original problem that lead you to believe you needed to make changes to the sketch.

sdingman:
and as you will see below added a bunch of other libraries.

Also probably the wrong thing to do.

sdingman:
Hello all, I recently my sketch from an uno to a Mega2560 because I was running out of memory when I tried to add a microSD adapter to my project. When I try to compile this sketch, I get a very extensive error ending with: Error compiling for board Arduino/Genuino Mega or Mega 2560.

We need to back up and look at the original problem. The "Error compiling for board Arduino/Genuino Mega or Mega 2560" error message is useless to us since there are an infinite number of possible causes of this generic error message. We need you to post the complete error output from the unmodified sketch.

sdingman:
I am confused about the #include<SD.h>

If you'll explain exactly what confuses you about it, I'm sure we can help you to understand.

Thanks Pert for responding. It seems by your response that there is a lot wrong in my sketch. Originally the errors that I got pointed to errors on specific rows of code that were highlighted. I think I had about four of those, and found my error and was able to fix them. After addressing those issues, which were all fixed apparently, my sketch still failed to compile, only this time the errors mentions that I had multiple copies of libraries, showing me the location of each of them and finally saying that the one used was:

C:\Users\Stephen\Documents\Arduino\libraries\SD

or

C:\Program Files (x86)\Arduino\libraries\SD

So I began to investigate why do I have more than one? I quickly found the built in Example sketches were located in the latter location, and the former location was where sketches that I wrote or modified were saved, by default to this location.

This where my confusion began. I'm not really sure of the way that it is supped to work. As I began to accumulate more and more sketches, this folder:

C:\Users\Stephen\Documents\Arduino\

So I started to create sub-directories of related sketch version development. Now it's a monster, that's eating me up.

Stephen

I feel that I must also mention that since I originally started this project on an UNO, In order to modify the sketch to run on the mega2560, I had to change a few things. For one, eliminate the use of Software Serial, since the mega has four serial ports. The other is that the UNO required that I use the, #include<SPI.h>, along with the #include<SD.h>, and the mega2560 did not as per:

So this is the reason I didn't, #include<SPI.h> in this mega2560 sketch. So even though I hadn't included SPI.h in the mega, I saw in the error log, that SPI.h was in there. So why did the UNO require SPI.h, and the mega, didn't.
This is where my confusion with the #include<SD.h> library began.
If anyone can help I'd appreciate it.

I have eliminated the <SDFat.h>, from the sketch, and I have cut back to a version I was working on that didn't include any of the commands to the microSD card adaptor. So it only Is a modification to adapt to the mega2560 and includes the <SD.h> library. The first part before, void setup:

/*ATS-EMON_3.0
ATS-EMON_merge_2.0
The merging of the Emon sketch to the Automatic Transfer Switch

V 3.0 11/11/2019 This will be the first attempt migrate to an ATmega2560 R3. Sketch uses 11990 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 1023 bytes (12%) of dynamic memory, leaving 7169 bytes for local variables. Maximum is 8192 bytes.
V 2.0 10/20/2019 This version corrects the Turn On Point and Turn Off Point issues and adds the Inverter Power Down Emergency Shutdown Scenario. 
 This has also been tidied up a bit.
V 1.9 Modifies the conditional if at line 105, that checks to see if % is between Turn off Point(90) and Turn on Point (94).
V 1.8 This version adds lines 104, 105, 106 and Remarks out line 103. The Switch wouldn't turn on with the 1.7 update. If the Inverter is on, and 
      the Transfer Switch is on and the Inverter on Indicator goes low, the Switch and Inverter will shut off.
V 1.7 This version Added line 101 to say, if % is below the turn off point or the InvOnInd is low, turn it off.
V 1.6 This version has added the all data being printed on one line and the Headings being printed out one time in void Setup.
V 1.5 This version removes the Line Feed that println adds after the last of the Battery Monitor data. This allows the Grid data to stay on the same line as the Battery Monitor data.
V 1.4: This version has no modifications within the ATS-EMON_merge. It is using a modified EmonLib.cpp file locate at:
     Network\steveacerlaptop\C:\Users\sdingman\Documents\Arduino\libraries\EmonLib\EmonLib.cpp.
V 1.3: This version also is the 2nd modification after merging Energy Monitor sketch into the Automatic Transfer Switch, thus the name ATS-EMON_merge
V 1.2 has a 2 second delay between postings. This will cut down on file size.
 
 Battery %,Watts,Days Since Charged,Days Since Equalized (PowerUp),Battery Voltage,Filtered Battery Voltage,Amps,Filtered Amps,Amp-Hours,Inverter Status,Inverter On Indicator Status,Load Transfer Status,On Setpoint,Off Setpoint,Grid Real Power,Grid Apparent Power,Grid Vrms,Grid Irms,Grid Power Factor,Inverter Real Power,Inverter Apparent Power,Inverter Vrms,Inverter Irms,Inverter Power Factor
 %  Watts DSC DSE Volts Filtered Volts  Amps  Filtered Amps Amp Hours Inverter InvOnIndicator Load Transfer  On SP Off SP
 ,094,-263,6.21,39.5,12.5,12.5,-21.5,-20.9,-25.6,High,High,High,95,90
 
 Concept: Stephen Dingman
 Coding: Alexander Dingman
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include "SD.h"
#include "EmonLib.h"             // Include Emon Library // First lines of emon added
EnergyMonitor emon1;             // Create an instance
EnergyMonitor emon2;             // Create a 2nd instance
 
//#include <SoftwareSerial.h>   //This version starts at turn on point nicely.
//SoftwareSerial myBatteryMonitor(2, 3); // RX, TX define the pins to use

const int loadTransfer = 4; //output Pin to select Grid or Inverter
const int invPower = 5;       //output Pin to turn inverter on
const int invOnInd = 6;       //input Pin to verify that inverter power is available.
const int toggleDelay = 3;        //delay switch by this number of datasets
int strBatteryLevel = 0;    //Counts the 5 positions of '%=xxx'.
                            //'strBatteryLevel' will be used to count Characters.
int batteryPerc = 0;      //Will be the Integer equivalent of the String 'batteryLevel'
String batteryLevel="";   //'batteryLevel' is a String to store the Concatenated values of 'a' after the % symbol is encountered.
//String relayToggle;     //Currently not used
//String loadTransferToggle="Load Transfer: LOW";  //Takes on the pin 5 value, "Load Transfer: HIGH" or "Load Transfer: LOW"
String loadTransferToggle="LOW";
//String inverterToggle="Inverter: LOW";      //Takes on the pin 4 value, "Inverter: LOW" or "Inverter: High"
String inverterToggle="LOW";
String relayToggle = "ON";      //Not used.
String strData;                 // This stores the whole dataset.
int count;                      //This is a % symbol detector. If % is found it is incremented
int countpctOn;         //ON, I will use this to count the number of times that the battery % is the value that is in the data stream,
                        //before it is acted upon to turn on.
int countpctOff;          //OFF, This variable will be used to turn off the Transfer Switch and the Inverter.
int turnOnPoint = 94; 
int turnOffPoint = 90;

Next I'll include only the void setup:

void setup(){
  Serial.begin(9600); // speed to talk to the computer
  //myBatteryMonitor.begin(2400); 
  Serial1.begin(2400);      // Digital 19 (Rx), Digital pin 18 (Tx) speed to read the Battery Monitor

  //Section added below for Emon
  //realpower, apparent power, Vrms, Irms, power factor
  emon1.voltage(0, 140.00, 1.7);  // Grid Voltage: input pin, calibration, phase_shift; calibLast=142.85,150.0,142.0,140.0,135.0,130.0,125.0,120.0,115.0
  emon2.voltage(1, 137.00, 1.7);  // Inverter Voltage: input pin, calibration, phase_shift;
  emon1.current(2, 10);       // Grid Current: input pin, calibration.
  emon2.current(3, 10);       // Inverter Current: input pin, calibration.

  pinMode(loadTransfer, OUTPUT);//Pin 4, Output to switch main power relay 
  pinMode(invPower, OUTPUT);   //Pin 5, Output to switch Inverter on 
  pinMode(invOnInd, INPUT);    //Pin 6, Input verifying Inverter is on and ready
  count = 0;         //Count is initially set to 0. When % is found, it increments by 1.
  countpctOn = 0;     //Used to count successive battery % values to eliminate any one time glitches.
  countpctOff = 0; 
  Serial.println("Battery %,Watts,Days Since Charged,Days Since Equalized (PowerUp),Battery Voltage,Filtered Battery Voltage,Amps,Filtered Amps,Amp-Hours,Inverter Status,Inverter On Indicator Status,Load Transfer Status,On Setpoint,Off Setpoint,Grid Real Power,Grid Apparent Power,Grid Vrms,Grid Irms,Grid Power Factor,Inverter Real Power,Inverter Apparent Power,Inverter Vrms,Inverter Irms,Inverter Power Factor"); 
}
  
void loop() {
  //The coding below is for the Automatic Transfer Switch.
  if(Serial1.available() > 0){             //If there is a signal coming in
    char a = Serial1.read();             //place that character into character variable 'a'.                                       
    if(strBatteryLevel>0){                    //'strBatteryLevel' is a character counter that only increments when a=%.
      strBatteryLevel++;                  //The only way that 'strBatteryLevel' could be > 0 is if a=%.
      if(a=='='){}                            //while still under the influence of 'a' being a %, looking at the next 
      else{batteryLevel+=a;}                  // otherwise, concatenate the Character value in 'a' to 'batteryLevel' String. Count the number of bytes after encountering a %.
    }
    if(strBatteryLevel==5){                   //Checks to see if the number of characters in 'strBatteryLevel' are counted up to 5 characters. Check to see if the number of 
      //bytes is up to 5 after encountering a %=xxx is 5 characters long. Which would mean it is over 100.0 %.
      strBatteryLevel=0;                      //Reset the count of characters stored in 'strBatteryLevel' to 0
      batteryPerc = batteryLevel.toInt();           //batteryPerc becomes the Integer form of the String 'batteryLevel'.
      batteryLevel="";                        //The 'batteryLevel' string variable is set to be empty.
    }
    if(a =='%') {                       //If the character coming in is a '%' symbol
      count++;                          //Increment the count integer. If 'a' is not %, skip this line.
      strBatteryLevel++;                //Increment the strBatteryLevel integer. If a is not %, skip this line.
    }
    if(count >=1){                          //If the 'count' integer is 1 or more. If a was a %, then proceed.
      count = 0;                                    //Check to see if we have received a % symbol. Reset the 'count' integer to 0
      if(ReturnValue("%",strData)>turnOffPoint) { 
        if (digitalRead(invPower)==HIGH && digitalRead(loadTransfer)==HIGH && digitalRead(invOnInd)==LOW) {      //This would indicate an Inverter shut down scenario
          if(countpctOff>=toggleDelay){
            digitalWrite(loadTransfer,LOW);
            loadTransferToggle = "LOW";
            digitalWrite(invPower, LOW);
            inverterToggle = "LOW";
          }
          countpctOff++;
          countpctOn=0;
        }

        if(ReturnValue("%",strData)>=turnOnPoint){
          if(countpctOn>=toggleDelay){
            digitalWrite(invPower,HIGH);
            inverterToggle = "HIGH";
          }
          if(digitalRead(invOnInd)==HIGH){
            digitalWrite(loadTransfer,HIGH);
            loadTransferToggle = "HIGH";
          }
          countpctOn++;
          countpctOff=0;
        }
      }

      if(ReturnValue("%",strData)<=turnOffPoint) {
        if(countpctOff>=toggleDelay){
          digitalWrite(loadTransfer,LOW);
          loadTransferToggle = "LOW";
          digitalWrite(invPower, LOW);
          inverterToggle = "LOW";
        }
        countpctOff++;
        countpctOn=0;

      }

      CheckDaysSinceCharge(ReturnValue("DSC",strData));

      //("Battery %,Watts,Days Since Charged,Days Since Equalized (PowerUp),Battery Voltage,Filtered Battery Voltage,Amps,Filtered Amps,Amp-Hours,Inverter Status,Inverter On Indicator Status,Load Transfer Status,On Setpoint,Off Setpoint")

      Serial.println("");
      Serial.print(ReturnValue("%",strData));   //Print Battery %
      Serial.print(",");
      Serial.print(ReturnValue("W",strData));   //Print Watts
      Serial.print(",");
      Serial.print(ReturnValue("DSC",strData));  //Print DSC (Days Since Charged)
      Serial.print(",");
      Serial.print(ReturnValue("DSE",strData));  //Print DSE (Days Since Empty)Days Since Battery Disconnected
      Serial.print(",");
      Serial.print(ReturnValue("V",strData));   //Battery Voltage
      Serial.print(",");
      Serial.print(ReturnValue("FV",strData));  //Float Battery Voltage
      Serial.print(",");
      Serial.print(ReturnValue("A",strData));   //Amps, +Into or -Out of the Battery
      Serial.print(",");
      Serial.print(ReturnValue("FA",strData));  //Floating Amps, +Into or -Out of the Battery
      Serial.print(",");
      Serial.print(ReturnValue("AH",strData));  //-Amp Hours removed from a Full Charge at 0
      Serial.print(",");
      Serial.print(inverterToggle);
      Serial.print(",");
      Serial.print(digitalRead(invOnInd));
      Serial.print(",");
      Serial.print(loadTransferToggle);
      Serial.print(",");
      Serial.print(turnOnPoint);
      Serial.print(","); 
      Serial.println(turnOffPoint);
      Serial.println("");
      delay(2000);
      strData = "";     



      //This is the last section that will be added from the Emon Sketch
      emon1.calcVI(20,2000);         // Calculate all. No.of half wavelengths (crossings), time-out
      emon2.calcVI(20,2000);         // Calculate all. No.of half wavelengths (crossings), time-out

      //Serial.print("Grid ");
      emon1.serialprint();           // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
      Serial.println("");
      //Serial.print("Inverter ");
      emon2.serialprint();           // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
      Serial.println("");
      delay(2000);
    }       //This is the closing brace for: if(count >=1)

    strData += a;         //Concatenate all data into 'strData'

  }    //This is the closing brace for the: if(Serial1.available() > 0) 

}    //This is the closing Brace for the void loop
 
//Search strData for searchStr and find accompaning value
float ReturnValue(String searchStr, String strData){
  String strValue;
  strValue = strData.substring(strData.indexOf(","+searchStr+"=")+searchStr.length()+2,strData.indexOf(",",strData.indexOf(searchStr)));
  //Find value of following searchStr
  return strValue.toFloat();
}
void CheckDaysSinceCharge(float days){
  if(days>=14){
    turnOnPoint=101;
  }
  if(days<=1){
    turnOnPoint=94;
  }
}

The non verbose error log is here:

Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::voltage(unsigned int, double, double)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::current(unsigned int, double)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::voltageTX(double, double)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::currentTX(unsigned int, double)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::serialprint()'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::readVcc()'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::calcVI(unsigned int, unsigned int)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\EmonLib\Original_EmonLib.cpp.o (symbol from plugin): In function `EnergyMonitor::voltage(unsigned int, double, double)':

(.text+0x0): multiple definition of `EnergyMonitor::calcIrms(unsigned int)'

libraries\EmonLib\EmonLib.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "SD.h"
 Used: C:\Users\sdingman\Documents\Arduino\libraries\SD
 Not used: C:\Program
Multiple libraries were found for "EmonLib.h"
 Used: C:\Users\sdingman\Documents\Arduino\libraries\EmonLib
Multiple libraries were found for "SPI.h"
 Used: C:\Program
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.