Pardon if this has been answered 1000 times before, but I couldn't find a clean answer anyplace.
I've installed a new library (I've tried several with the same result, but GitHub - electronicdrops/RFIDRdm630: Arduino Library for RDM630 RFID 125Khz module for example) from a zip file into ~username/Documents/Arduino/library. It shows up in the appropriate menus (Examples, Sketch -> Include Library) but when I try to compile (Verify or Upload), I get an error message that the include file cannot be found.
Example:
#include <RFIDRdm630.h>
const int rxPin = 6; // pin that will receive the data
const int txPin = 7; // connection not necessary.
//char * tag;
RFIDtag * tag; // a pointer to an RFIDtag object
RFIDRdm630 reader = RFIDRdm630(rxPin,txPin); // the reader object.
void setup() {
Serial.begin(9600); // open the Serial for show data
}
void loop() {
if (reader.isAvailable()){ // tests if a card was read by the module
tag = reader.getTag(); // if true, then receives a pointer to an tag object
Serial.print("TAG: ");
Serial.print(tag->getTag()); // get TAG in ascii format
Serial.print(" Card Number: ");
Serial.println(tag->getCardNumber()); // get cardNumber in long format
Serial.println();
I'm not sure what could be wrong. From the output I can see that the RFIDRdm630 folder is in the right place but it's being considered invalid by the Arduino IDE. Here's my advice:
Delete /Users/bownes/Documents/Arduino/libraries/RFIDRdm630. Please be very careful when deleting things on your computer. When in doubt back up!
/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_modified_sketch_929908/getTAG.ino:21:24: fatal error: RFIDRdm630.h: No such file or directory #include <RFIDRdm630.h>
I notice that the getTAG file uses "RFIDRdm630.h". I tried both " and <>. Same result.
Please post the full error output. I want to see if you're still getting the same invalid library warning.
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.
Strange. We fixed the invalid library warning at least but I don't understand why it's still having the error. Does the file /Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/RFIDRdm630.h exist?
One thing that I notice is that the library author has incorrectly capitalized the Examples folder. The library specification states that folder name should be in all lowercase. I don't see why that would make any difference but you could try renaming the folder just to make sure it's not causing a problem.
tunguska:getTAG bownes$ ls -l /Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/RFIDRdm630.h
-rw-r--r--+ 1 bownes staff 2035 May 18 18:19 /Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/RFIDRdm630.h
I find it interesting that the example code has the .h in "s, yet when you do an 'include library', it puts the .h in <>. Not that it makes a difference.
As you suspect, moving it from Examples to examlples made no difference.
On a lark, I put a copy of the .h file in the same directory as the source, went with the " syntax for local include and got this:
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/bownes/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/bownes/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/bownes/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10613 -build-path /var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avrdude.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -verbose /Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/bownes/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/bownes/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/bownes/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10613 -build-path /var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avrdude.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/Users/bownes/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -verbose /Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino
Using board 'uno' from platform in folder: /Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18
Using core 'arduino' from platform in folder: /Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18
Detecting libraries used...
"/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10613 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/cores/arduino" "-I/Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/variants/standard" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/sketch/getTAG.ino.cpp" -o "/dev/null"
"/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10613 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/cores/arduino" "-I/Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/variants/standard" "-I/Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/libraries/SoftwareSerial/src" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/sketch/getTAG.ino.cpp" -o "/dev/null"
<redacted to meet 9k char limit>
"/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-gcc-ar" rcs "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/core/core.a" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/core/new.cpp.o"
Linking everything together...
"/Users/bownes/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/getTAG.ino.elf" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/sketch/getTAG.ino.cpp.o" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/libraries/SoftwareSerial/SoftwareSerial.cpp.o" "/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924/core/core.a" "-L/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T/arduino_build_810924" -lm
/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T//ccsy7nUn.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':
/Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino:30: undefined reference to `RFIDRdm630::RFIDRdm630(int, int)'
/var/folders/_0/30sfgnb12fzcdr2cc9fz0nhc0000gp/T//ccsy7nUn.ltrans0.ltrans.o: In function `loop':
/Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino:42: undefined reference to `RFIDRdm630::isAvailable()'
/Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino:44: undefined reference to `RFIDRdm630::getTag()'
/Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino:47: undefined reference to `RFIDtag::getTag()'
/Users/bownes/Documents/Arduino/libraries/RFIDRdm630-master/examples/getTAG/getTAG.ino:49: undefined reference to `RFIDtag::getCardNumber()'
collect2: error: ld returned 1 exit status
Using library SoftwareSerial at version 1.0 in folder: /Users/bownes/Library/Arduino15/packages/arduino/hardware/avr/1.6.18/libraries/SoftwareSerial
exit status 1
Error compiling for board Arduino/Genuino Uno.
causes the IDE to search the sketch folder and then the libraries folders for the file.
#include <RFIDRdm630.h>
causes the IDE to search only the libraries folders for the file.
In this case #include <RFIDRdm630.h> is more correct but either will work, maybe #include "RFIDRdm630.h" causes a little slower compilation. In the case of you moving the .h file to the sketch folder #include "RFIDRdm630.h" is required.
It is possible to place libraries in the sketch folder but you would need to put the .cpp file in the sketch folder also. The library source files will appear as tabs in the Arduino IDE when you open the sketch which may be annoying. If so you can put them in the /src/RFIDRdm630/ subfolder of your sketch folder and change the include in the sketch to:
I'm having the exact problem with softwareserial.h. i did not have this problem yesterday. i tried reloading arduino from scratch, no effect...please help i use softwareserial for many of my projects
why do you have esp8266 installed at /Users/bluegure/Documents/Arduino/hardware/esp8266com? It seems like you have two versions of the package installed, the other is at /Users/bluegure/Library/Arduino15/packages/esp8266, which is where it gets installed if you do a Boards Manager installation.
i manually installed it by mistake then added the url for the board...has not caused any issues for months so i never fixed it
when i add a copy of softwareserial downloaded from "Create" i get this:
n file included from /Users/bluegure/Documents/Arduino/sketches/Tank/Virtuino_esp12e/Virtuino_esp12e.ino:42:0:
/Users/bluegure/Documents/Arduino/libraries/SoftwareSerial/SoftwareSerial.h:26:21: fatal error: variant.h: No such file or directory #include <variant.h>
^
compilation terminated.
Using library virtuino in folder: /Users/bluegure/Documents/Arduino/libraries/virtuino (legacy)
Using library SoftwareSerial at version 1.0.0 in folder: /Users/bluegure/Documents/Arduino/libraries/SoftwareSerial
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
i did a search for the file and it is nowhere on my system (except the one i downloaded} is there a place where i can get the complete library? when i try to add the .zip from "Create" it says "invalid library"
The SoftwareSerial library should be found at /Users/bluegure/Documents/Arduino/hardware/esp8266com/esp8266/libraries/SoftwareSerial. You may find other copies elsewhere on your computer. For example, the AVR version located in the Arduino IDE installation folder. That copy will not be used by the Arduino IDE because it is part of the Arduino AVR Boards package and so is not compatible with ESP8266.
My advice is to delete /Users/bluegure/Documents/Arduino/hardware/esp8266com and then install the esp8266 core using Boards Manager. Please be very careful when deleting files on your computer. When in doubt, back up!