View Single Post
  #12   Spotlight this post!  
Unread 08-02-2007, 19:02
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: OI Input Autonomous

Quote:
Originally Posted by Michael DiRamio View Post
It's important. It means you're calling a method that doesn't exist. Check your spelling on that line. Remember that method names are case sensitive.
Either that or you're calling a function before it is declared. This code will generate the warning
Code:
void void main()
{
  func();
}

void func()
{
}
From the compiler's point of view, it doesn't know that func exists when it parses through main and thus throws the warning.

Here are two ways to get rid of the warning. I prefer the first method.

1. Create a function prototype either at the top of the C file or in a header included by that C file. This will tell the compiler that a function named func that takes no inputs and returns nothing is defined somewhere in the code.
Code:
void func(void);  /* Here is the prototype */

void main()
{
  func();
}

void func()
{
}
2. Write your function before you call it. In this case, the compiler will parse through the function and know about it by the time it gets to the call.
Code:
void func()
{
}

void main()
{
  func();
}
I highly suggest that you get in the habit of dealing with warnings as they pop up so that they don't get lost in the shuffle and manifest themselves into a problem.