I have this large program I'm working on and I use a class called keyboard. In a second part of this large program I wanted to use that class again but now, it does not name a type. Odd, seems to work fine where it is first used.
Anyway after all evening fighting this I broke it out into the simplest .ino and Lib files I cold and.. Still does not name a type.
Arduino: 1.8.7 (Mac OS X), TD: 1.44, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz, Faster, US English"
keyboard_test:10: error: 'keyboard' does not name a type
keyboard* ourKeyboard;
^
keyboard_test: In function 'void setup()':
keyboard_test:14: error: 'ourKeyboard' was not declared in this scope
ourKeyboard = newkeyboard(NULL);
^
keyboard_test:14: error: 'newkeyboard' was not declared in this scope
ourKeyboard = newkeyboard(NULL);
^
Multiple libraries were found for "SD.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
Multiple libraries were found for "gfxfont.h"
Used: /Users/Dads/Documents/Arduino/libraries/Adafruit-GFX
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ssd1351
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ssd1351
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ssd1351
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ssd1351
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX
Multiple libraries were found for "Adafruit_ILI9341.h"
Used: /Users/Dads/Documents/Arduino/libraries/Adafruit_ILI9341
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_ILI9341
'keyboard' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Seems it not a code problem. Its something weird going on with the IDE. I pulled all the keyboard files into a folder with a test program. That revealed that the IDE just wasn't compiling the libraries anymore. I'd done edits here and there in the libraries and it hadn't picked up on them until I moved things around. Suddenly there were all these typos I'd missed and never been told about. Cleaned them up and everything compiled fine.
Wonderful, so I packed this set into its own folder LC_keyboard dumped it into the library folder and.. The error comes back. Not a type, and we ain't telling you why. If they are in the folder with the .ino, everything is fine.
I can add errors to the file, and they never turn up. Its like its just not compiling the libraries anymore.
I'm not familiar with Arduino on Mac (or Mac at all really), but I would have thought you have something misconfigured since this is really basic functionality that should just work.
Things to try:
Close all instances of the Arduino IDE and then restart and try again.
Turn on verbose output during compilation to see if there is any additional info.
Manually install some other random library into the same folder to see if it compiles.
My guess is that the compiler is including the built-in "Keyboard.h" instead of your private "Keyboard.h". That would leave your "class keyboard;" undefined and thus the:
keyboard_test:10: error: 'keyboard' does not name a type
keyboard* ourKeyboard;
^
keyboard_test: In function 'void setup()':
keyboard_test:14: error: 'ourKeyboard' was not declared in this scope
ourKeyboard = newkeyboard(NULL);
^
Not only some filename conflict, but a teensy filename conflict. I decided to force a recompile of my libraries changing to compiling for a UNO. And it sailed right through. Swapping back to my teensy, no go. Then I switched the filename to scrKeyboard.h and everything seems to work now.