Cannot get a simple program to work... Please help

I am trying to program my Arduino press and hold the mac left ‘option’ key down immediately once I plug it in. Here’s my current code after consulting various Q&A discussions:

#include <usb_keyboard.h>
//Code to press and hold the left Option key in Mac OS X (not sure if it is the right one)
keyboard_modifier_keys = KEY_LEFT_ALT;
keyboard_keys[0] = 0;
keyboard_keys[1] = 0;
keyboard_keys[2] = 0;
keyboard_keys[3] = 0;
keyboard_keys[4] = 0;
keyboard_keys[5] = 0;
usb_keyboard_send();
_delay_ms(5000);

However, an error message occurs when I try to verify this code, and states that ‘keyboard_modifier keys’ does not name a type. Can someone please let me know what I did wrong to program a seemingly easy task?

Thanks!

However, an error message occurs when I try to verify this code,

No.
An error message occurs when you try and verify the code you have. All you have given us is a snippet, you are better off going here with a snippet:-
http://snippets-r-us.com/

Assuming it might be a Teensy board, you probably need to include their usb_keyboard.c file where it will define keyboard_modifier_keys

What board are you using, what library did you download, what hardware are you using to connect the board (if not Leonardo/Micro) to be a USB device?