troubleshooting error

Hey I tried to upload some code but then I got the error message I'm a newbie and wasn't sure how to fix an undefined reference got the code online and shouldn't have any errors

Compiling sketch...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\sketch\soilhumitidy.ino.cpp" -o "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\sketch\soilhumitidy.ino.cpp.o"
Compiling libraries...
Compiling library "Wire"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp" -o "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\libraries\Wire\Wire.cpp.o"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10808 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c" -o "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\libraries\Wire\utility\twi.c.o"
Compiling core...
Using precompiled core: C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_cache_598340\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
Linking everything together...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699/soilhumitidy.ino.elf" "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\sketch\soilhumitidy.ino.cpp.o" "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\libraries\Wire\Wire.cpp.o" "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\libraries\Wire\utility\twi.c.o" "C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699/..\arduino_cache_598340\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699" -lm
C:\Users\WOUTEM~1\AppData\Local\Temp\ccefsoog.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_soilhumitidy.ino.cpp.o.1789':

C:\Users\WOUTempAdmin\AppData\Local\Temp\untitled1480842969.tmp\soilhumitidy/soilhumitidy.ino:10: undefined reference to `NS_energyShield2::NS_energyShield2()'

C:\Users\WOUTEM~1\AppData\Local\Temp\ccefsoog.ltrans0.ltrans.o: In function `setup':

C:\Users\WOUTempAdmin\AppData\Local\Temp\untitled1480842969.tmp\soilhumitidy/soilhumitidy.ino:13: undefined reference to `NS_energyShield2::begin()'

C:\Users\WOUTempAdmin\AppData\Local\Temp\untitled1480842969.tmp\soilhumitidy/soilhumitidy.ino:17: undefined reference to `NS_energyShield2::sleepSeconds(long)'

collect2.exe: error: ld returned 1 exit status

Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
exit status 1
Error compiling for board Arduino/Genuino Uno.

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor) on your code. This will make it easier for you to spot bugs and make it easier for us to read.
  • In the Arduino IDE or Arduino Web Editor, click on the window that contains your sketch code.
  • Press "Ctrl + A". This will select all the text.
  • Press "Ctrl + C". This will copy the selected text to the clipboard.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the sketch between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.
  • Repeat the above process if your sketch has multiple tabs.

This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.

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.

When your code requires a library that's not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

Ok thanks here is the code

<// In this example, the Arduino turns on, blinks the LED,
// and then turns off for 4 seconds. This results in a
//power duty cycle of approximately 1000/(1000 + 4000),
//or 20% (assuming negligeble boot time). This means
//that the battery will last about 5 times as long as
//if the Arduino had run constantly.
#include "Utilities.h"
#include "NS_energyShield2.h"

NS_energyShield2 es2;

void setup() {
es2.begin(); // Initialize energyShield 2

es2.sleepSeconds(4); // Power turns off here

}

void loop() {}>

It's for an energy shield pro 2 got all the code and library's from their website NightShade Electronics - Home wasn't sure if this was an ardiuno problem or energy shield pro2 problem Thank for looking into it.

Where are those 2 libraries located in your file system? Try:

#include <Utilities.h>
#include <NS_energyShield2.h>

Ok did what you said and the error code was

Arduino: 1.8.8 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\WOUTempAdmin\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10808 -build-path C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699 -warnings=none -build-cache C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_cache_598340 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\WOUTempAdmin\AppData\Local\Temp\untitled1480842969.tmp\soilhumitidy\soilhumitidy.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\WOUTempAdmin\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10808 -build-path C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699 -warnings=none -build-cache C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_cache_598340 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\WOUTempAdmin\AppData\Local\Temp\untitled1480842969.tmp\soilhumitidy\soilhumitidy.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Build options changed, rebuilding all
open C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\sketch\soilhumitidy.ino.cpp: Access is denied.
Error compiling for board Arduino/Genuino Uno.
Invalid library found in C:\Users\WOUTempAdmin\Documents\Arduino\libraries\energyShield2-master: no headers files (.h) found in C:\Users\WOUTempAdmin\Documents\Arduino\libraries\energyShield2-master
Invalid library found in C:\Users\WOUTempAdmin\Documents\Arduino\libraries\energyShield2-master: no headers files (.h) found in C:\Users\WOUTempAdmin\Documents\Arduino\libraries\energyShield2-master

The problem was six lines up

05bmckay:

open C:\Users\WOUTEM~1\AppData\Local\Temp\arduino_build_665699\sketch\soilhumitidy.ino.cpp: Access is denied.

This sort of error could be caused by your antivirus software. Try TEMPORARILY disabling your antivirus for a single compilation to see if the problem goes away, then turn the antivirus back on. If the problem doesn't occur with the antivirus off you will need to adjust the settings of your antivirus to whitelist the appropriate file, folder, or process so it doesn't interfere with compilation.