Arduino reports an error when writing a custom library file to solve the problem of not name of type, not declared in this scope

The first time I tried to write an Arduino library file, I failed to compile it.
Here’s a summary of where things go wrong.
We usually create our own library directories and files under the Arduino/Libraries directory. Note, however, that the Libraries directory is read-only by default.
Once we’ve created the library, it’s time to use it. When we open up the Arduino application and start writing the application, when we import our custom library, the library in the Libraries directory will automatically copy to our projects folder.
Then the problem comes. When we write the libraries that need to be modified due to errors, when we modify the libraries in the library directory, the libraries in the project directory have not been modified, so the compilation is still stubborn and cannot pass. The solution in this case is to modify the library files in the project directory.

The compiler always declares variables that are not declared because the library file is not included or because the library file does have syntax errors.
does not name of type
xxx was not declared in this scope

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
sketch_dec23a:6: error: ‘LightClass’ does not name a type
sketch_dec23a.ino: In function ‘void setup()’:
sketch_dec23a:12: error: ‘light’ was not declared in this scope
sketch_dec23a.ino: In function ‘void loop()’:
sketch_dec23a:17: error: ‘light’ was not declared in this scope

Read More: