Please Help Me Part 2

Here is my code:

" int main; {
//Set up callbacks for autonomous and driver control periods.

vex::competition(usercontrol);

//Prevent main from exiting with an infinite loop.                        
while(1) {
  vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
}    

}"

This is the error in control center:
"07:27:27 – error – In file included from cxx_entry.cpp:16:
./main.cpp:48:2: error: main cannot be declared as global variable
int main; {
^
./main.cpp:48:12:
07:27:27 – error – error: expected unqualified-id
int main; { "

Here is what the error bubble says:
β€œmain cannot be declared as a global variable
int main; {
^”

Please help me.

Remove the semicolon from β€˜int main;’, it doesn’t need one since its a function declaration.

1 Like

It needs to be

int main() {
    //your code
}

That is how you declare functions in cpp.

1 Like