You're probably missing an include at the beginning of your code.
#include <somefile.h>
// other code here
...
...
where somefile.h is the file that contains the missing definitions; possibly Keyboard.h
Please edit your post and change the quote tags to code tags so your post looks like
your code here
Easier to read and easier to copy.
Question: which board are you using?