global variables scope error

Hi Folks:

I'm trying to write a state machine for a push button, but run into compile error

/**************************************************************************************
VDIL_Monitor_Button.ino
3 Oct 2013
Desc: Two buttons, both must be pressed before sending a string to E-Prime through 
serial port
**************************************************************************************/
//global  

//constants - things that don't change during program lifetime
const byte buttonPin1 = 7 ;    //button pin
const byte buttonPin2 = 6 ; 

//create data structure to represent push button
enum buttonState {idle=0, pressed, on, released} ;    // possible state of a button

typedef struct
{
    byte buttonPin ;
    enum buttonState button_state ;

} button ;

// declare global variable
button button1 ;
button button2 ;
button *button1_ptr ;  // pointers to global variables
button *button2_ptr ;

void CheckButton(button *button_ptr) ;

void setup()
{
    Serial.begin(115200) ;
    pinMode(buttonPin1,INPUT) ;   
    pinMode(buttonPin2,INPUT) ; 

    //define global variables, memories allocated
    button1.buttonPin = buttonPin1 ;
    button1.button_state = idle ;
    button2.buttonPin = buttonPin2 ;
    button2.button_state = idle ;


    //point pointers to global variable
    button1_ptr = &button1 ;
    button2_ptr = &button2 ;


}

void loop()
{
    CheckButton(button1_ptr) ;
    if (button1_ptr->button_state == pressed)
        Serial.println("Button 1 is pressed") ;



}

void CheckButton(button *button_ptr)
{
    int buttonValue = digitalRead(button_ptr->buttonPin) ;

    if (buttonValue == LOW & button_ptr->button_state == idle)
        button_ptr->button_state = pressed ;

    if (buttonValue == LOW & button_ptr->buttonPin == pressed)
        button_ptr->buttonPin = on ;

    if(buttonValue == HIGH & button_ptr->buttonPin == on)
        button_ptr->buttonPin = released ;

    if(buttonValue == HIGH & button_ptr->buttonPin == released)
        button_ptr->buttonPin = idle ;
}

I got the following compile error " VDIL_Monitor_Button.ino : variable or field 'CheckButton' declared void VDIL_Monitor_Button.ino : 'button' was not declared in this scope VDIL_Monitor_Button.ino : 'button_ptr' was not declared in this scope"

I'm scratching my head on how to debug this, any help is appreciated.

Cheers!

Oh? I got:

Done compiling.

Binary sketch size: 2,450 bytes (of a 32,256 byte maximum)

I should have thought about this one, I used Visual Micro in Visual Studio 2010 and the Output window gave the error from “Micro Build”, I don’t know what “Micro Build” means but running through Arduino 1.0.5 yield no compiler error, thanks for your help.