|
Re: printf could not find definition
There was a transition this past season in the printf implementation that has caused this confusion. There are two different printf’s that can be used depending on the compiler version you are running.
When you use the older compiler, you must use the IFI printf by including printf_lib.c/.h in your projects. But the flip side of using the older compiler is you cannot use the CMU camera default code, because the camera part won’t execute correctly (however if you don’t use the camera it’ll drive fine – nothing unusual there). The project for the CMU camera version of the default code is setup to pull printf from the standard library, but as Stephanie discovered you can add the IFI printf version to the project and use that instead.
--------
Along with the two major compiler releases that concern FIRST teams there are also two major versions of the FIRST default code, v2.2(no camera) vs. v2.4(CMU camera).
The CMU camera code (v2.4) requires capabilities supplied only by the newer v2.4 compiler, and cannot be used with the older compiler. The older code can, however, be used with the newer compiler.
With the older C18 compilers (pre-v2.4) there was no printf supplied in the standard library (stdio). So for those older compilers IFI kindly wrote a printf, with some limitations, and gave it to us in those printf_lib.c and printf_lib.h files. This printf implementation is still usable, but you should read the header comments in printf_lib.c to understand the limitations. It’s the same as writing your own routine. In fact many teams modified or replaced the IFI printf code to alleviate some of the more glaring issues (buffer overwrite, space hog).
With the C18 v2.4 compiler special release to FIRST teams printf was included in the standard library, so the IFI version of printf was no longer necessary. The new version works better, but still has a few limitations you should read up on. You also need to be careful you don't inadvertently try to use both. Pick one or the other.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Last edited by Mark McLeod : 28-06-2005 at 09:02.
|