error: redefinition of 'int main()'

i keep getting this error in my code during verify/compile:

" In function 'int main()':
error: redefinition of 'int main()' "

am supposed to doing an alarmclock/stopwatch type of deal...
and i was trying to get the code to compile and run so that i can test if it's adding and subtracting correctly, and make sure i coded my interrupts to work correctly, and figure out how i can control lines on a serial lcd i am about to connect.

PLUS i apologize for all of the volatile declarations, but the compiler would not let me NOT declare it again within the voids.

#include <stdio.h>
#include <stdlib.h>
#include <avr\interrupt.h>
#include <math.h>

volatile int trigger1;
volatile int trigger2;
volatile int mode;
volatile int second;
volatile int second1;
volatile int second2;
volatile int second3;
volatile int minute;
volatile int minute1;
volatile int minute2;
volatile int minute3;
volatile int hour;
volatile int hour1;
volatile int hour2;
volatile int hour3;
int test_t;

void setup()
{
  pinMode(2, INPUT);          //Make digital 2 an input
    digitalWrite(2, HIGH);   // Enable pull up resistor
  pinMode(3, INPUT);        //  Make digital 3 an input
    digitalWrite(3, HIGH); //   Enable pull up resistor
  // Setup Interrupt 0, pin 2
  attachInterrupt(0, i_Zero, RISING);
  // Setup Interrupt 1, pin 3
  attachInterrupt(1, i_One, RISING);  
  interrupts();
  volatile int trigger1;
  volatile int trigger2;
  trigger1=0;
  trigger2=0;
}

void i_Zero()
{
  volatile int trigger1;
  trigger1=1;
}

void i_One()
{
  volatile int trigger2;
  trigger2=1;
}

void loop()
{
  volatile int trigger1;
  volatile int trigger2;
  volatile int mode;
  volatile int second;
  volatile int second1;
  volatile int second2;
  volatile int second3;
  volatile int minute;
  volatile int minute1;
  volatile int minute2;
  volatile int minute3;
  volatile int hour;
  volatile int hour1;
  volatile int hour2;
  volatile int hour3;
  //if interrupt 1 or button 1 is pressed
  if(trigger1 > 0)
  {
    volatile int mode;
    mode++;
    if(mode==5)
    {
      volatile int mode;
      mode=0;
    }
    volatile int trigger1;
    trigger1 = 0;
  }
  if(trigger2 > 0)
  {
    if(mode==1)
    {
      minute1++;
      second1=0;
    }
    if(mode==2)
    {
      hour1++;
      second1=0;
    }
    if(mode==3)
    {
      minute2++;
      minute3 = minute2;
    }
    if(mode==4)
    {
      hour2++;
      hour3 = hour2;
    }
    if(mode==5)
    {
      mode=0;
    }
    trigger2 = 0;
  }
}
  
int main()
{
  Clock_Set:
  if(mode != 0)
  {
    goto Clock_Count;
  }
  if(mode=0)
  {
    goto Elapsed_Count;
  }
  
  
  
  Elapsed_Count:
  second = second++;
  if(second == 60)
  {
    minute++;
    second = 0;
  }
  if(minute == 60)
  {
    hour++;
    minute = 0;
  }
  
  Remaining_Count:
  second3 = (second3 - 1);
  if(second3 == 0)
  {
    minute3 = (minute3 - 1);
    second3 = 59;
  }
  if(minute3 == 0)
  {
    hour3 = (hour3 - 1);
    minute3 = 59;
  }
  test_t = (hour3 + minute3 + second3);
  if(test_t == 0)
  {
    goto ALARM;
  }
  
  Clock_Count:
  second1 = second1++;
  if(second1 == 60)
  {
    minute1++;
    second1 = 0;
  }
  if(minute1 == 60)
  {
    hour1++;
    minute1 = 0;
  }
  if(hour1 == 12)
  {
    hour1 = 0;
  }
  
  
  DELAY_1:
  delayMicroseconds(999849);
  
  Display:
  Serial.print(second1, DEC);
  Serial.print(minute1, DEC);
  
  goto Clock_Set;
  
  
  ALARM:
  goto Clock_Set;
  
  return(0);
}

also,
am i allowed to use "goto Clock_Set" within the void loop? everytime i do, it says:

In function 'void loop()':
error: label 'Clock_Set' used but not defined In function 'int main()':

You've redefined "main".
Arduino sketches don't have a "main", it's provided for you.

You've also got some odd scoping going on with all those volatiles.

am i allowed to use "goto Clock_Set" within the void loop?

You almost certainly should never use "goto" - it will make the fairies cry.

thank you for taking a look, AWOL...

First:
thanks, i didn't know; however, once i remove int main(){}, it gives me error on my labels (i.e.: "Clock_Set:" or "Clock_Count:"), and if i remove or comment it, i get errors as soon as my if statements begin... (i.e.: "if(mode != 0)" )...

error: function definition does not declare parameters

line 115

error: expected unqualified-id before 'if'

line 116

Second:
yes, i know... but the compiler keeps making me declare my variables... and i didn't know if i using something like volatile int seconds, minutes, hours; would make all three variables "volatile".

please give me any insight you may have

There are no gotos and Lables in C. If you want to have sections under Clock_Set and Clock_Count you'll need to create a new void for each.

So you'll have.

void Clock_Set()
{
}

void Clock_Count()
{
}

Then you'll be able to go to that section by calling:

Clcok_Set();

or

Clock_Count();

@digimike

There are no gotos and Lables in C.

Well, that would be nice, but it isn't true.
There are.

however, once i remove int main(){}, it gives me error on my labels

Well, in C, executable code can only exist inside functions.
So, you need to work out what goes inside (or is called from) "setup", and what goes inside (or is called from) "loop"

Digimike:
i think the problem with that for me is:

i think that that doesn't actually goto that place, or leaves where you're currently at, it just calls and implements code in those void, and simply returns to where you called it...

if i do that, i'll have to call everything one-by-one and wrap it around an infinite while loop, which i don't think will be good...

***please correct me if i am wrong...

***please correct me if i am wrong...

Well...

it just calls and implements code in those void,

No, in C a goto does just that, it doesn't "call", with an implied return after the "call".

You really need to work through what it is you want to do - why are you so scared of infinite loops?
That's exactly what the Arduino's "loop" is!

yes, awol. that's why i was trying to use "goto", because i do not want to return, i want the code to goto specific parts, and continue running from there...

in that sort of loop...

[glow]volatile[/glow] int myvariable = 3;

void setup() {
   [glow]volatile int myvariable = 3;[/glow]
   digitalWrite(myvariable, HIGH);
}

You're misusing the volatile keyword, probably from a misunderstanding. The keyword "volatile" means "this variable's value may change without the compiler being able to see who changed it" and is needed only in extremely rare cases; it does NOT mean "there are two or more declarations to the same variable" because you can't have two or more declarations to the same variable. Take out "volatile" and take out all but one declaration of a given variable. If both setup() and loop() need the variable, keep a declaration that is outside of both of them. This is called a global variable. It can be seen (and modified) by all functions in the same tab of your sketch.

int myvariable = 3;

void setup() {
   digitalWrite(myvariable, HIGH);
}

thank you, halley.

that is what i tried to do in the very first place, but i kept receiving errors in the void loop, or anywhere else it was changed...

***Update: i cleaned up some stuff, and the compiler is not sticking on the variables now. Thanks.

All those "goto"s - they gotta go!
That is some serious spaghetti code.
Has this been translated from BASIC or something?