View Single Post
  #22   Spotlight this post!  
Unread 16-02-2005, 11:20
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,825
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Programming - Getting Started

Quote:
Originally Posted by russell
Can I call the function Limit_Mix as it exists in the v2.4 code from the autonomous mode section of user_routines_fast.c? I was under the impression that I can, but when I just tried to compile it gave me warnings about no function prototype (whatever that is ), but it seems to have compiled anyway.
The compiler works on one c file in your project at a time. When it comes across a call to a function it's never seen in that particular file before it doesn't know if you are using it correctly (passing the right type of variables, getting the correct type back), so it gives you a warning that it cannot check on the validity of how you've used it in your code.

You just need to tell the compiler a little bit about the function Limit_Mix. A function prototype does this, and it can be added to the top of your user_routines_fast.c file, or better yet to the user_routines.h file that gets included by user_routines_fast.c,
like so:
Code:
unsigned char Limit_Mix (int);

Prototypes is one of the main uses of the .h files, so any other file that needs to use Limit_Mix for example, will just need to include "user_routines.h"
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 16-02-2005 at 11:50.