Log in

View Full Version : 2005 default code won't compile


Robby
20-01-2005, 22:08
I just tried compiling the 2005 default code v2.4 released on 1/12/05 and for some reason it refuses to compile. It says that it can't find the definition for function printf and stops the build. This is the code with absolutely no modifications. Just wondering if anybody has an idea what might be wrong.

Mark McLeod
20-01-2005, 22:53
I just tried compiling the 2005 default code v2.4 released on 1/12/05 and for some reason it refuses to compile. It says that it can't find the definition for function printf and stops the build. This is the code with absolutely no modifications. Just wondering if anybody has an idea what might be wrong.Check the option settings of MPLAB.
Project -> Build Options... -> Project
"Include Path" should be C:\mcc18\h
"Library Path" should be C:\mcc18\lib

Robby
20-01-2005, 22:58
Check the option settings of MPLAB.
Project -> Build Options... -> Project
"Include Path" should be C:\mcc18\h
"Library Path" should be C:\mcc18\lib


those are correct, it compiles code from last year and the 2005 code released on 1/7/05

Alan Anderson
20-01-2005, 23:50
The IFI (http://www.ifirobotics.com/rc.shtml#Programming) site says that version 2.4 of the default code "works only with C18 Compiler (ver 2.4) from Microchip". Have you obtained and installed the new compiler?

Robby
21-01-2005, 11:26
The IFI (http://www.ifirobotics.com/rc.shtml#Programming) site says that version 2.4 of the default code "works only with C18 Compiler (ver 2.4) from Microchip". Have you obtained and installed the new compiler?


i do have the new compiler

jgannon
21-01-2005, 11:45
Could you paste the exact error that the compiler is giving you? It would help us diagnose your problem.

cibressus53
24-01-2005, 11:10
i'm experiencing the same problem, the exact error says

cannot find deffinition for function "printf" in (whatever file it's being called it)

it gives no compile error, just a build fail.

Mark McLeod
24-01-2005, 12:43
Do either of you still have the old compiler installed as well as the new compiler?

It seems like you are linking with an earlier version of the compiler standard library clib.lib.
That's where printf should now be coming from. Older compiler versions didn't have a printf in the library and teams used the IFI version in the project printf_lib as a substitute.

marccenter
24-01-2005, 14:34
Good call, Mark McLeod!.
I had issues initially, but based on past work experience, removed the old C ompiler and installed the new C compiler and errors went away. Some experienced computer users do this as a matter of SOP (standard operating procedure). Removing the old compiler program as completely as possible and installing the new MPLAB C-compiler may be your ticket to solving this kind of problem is good advice for high school students and for those of us who are a few year's removed from high school!

Joe Ross
24-01-2005, 15:08
The readme file for the new compiler states that it can't be installed at the same time as the old compiler. They did make a change so that any newer compiler can be installed at the same time as 2.4, but it's not backwards compatible.

ElGeeko
28-01-2005, 12:50
I started off never having installed anything but MCC18 v2.4 on the team laptop (along with the GUI) and I still run into problems.

Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "c:\mcc18\bin\mcc18.exe" -p=18F8520 "control.c" -fo="c:\code\code_v2.4\control.o" /i"C:\Dev-Cpp\include" /i" c:\code\code_v2.4" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
c:\code\code_v2.4\control.c:12: unable to locate 'ifi_aliases.h'
c:\code\code_v2.4\control.c:13: unable to locate 'ifi_default.h'
c:\code\code_v2.4\control.c:14: unable to locate 'ifi_utilities.h'
c:\code\code_v2.4\control.c:15: unable to locate 'user_routines.h'
c:\code\code_v2.4\control.c:16: unable to locate 'user_Serialdrv.h'
c:\code\code_v2.4\control.c:17: unable to locate 'user_routines.c'
error 1 spawning c:\mcc18\bin\cpp18
Halting build on first failure as requested.
BUILD FAILED: Fri Jan 28 00:07:44 2005

So, did I do something really stupid?

Mark McLeod
28-01-2005, 13:10
Executing: "c:\mcc18\bin\mcc18.exe" -p=18F8520 "control.c" -fo="c:\code\code_v2.4\control.o" /i"C:\Dev-Cpp\include" /i" c:\code\code_v2.4" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-The space between the quote and drive /i" c:..." is "driving" it batty.
Typo's are so much fun;)

You also don't include mcc18/h, why is that?

ElGeeko
28-01-2005, 15:45
I think I was trying to test out other include files but I originally did include mcc18/h and c:\mcc18\h as well as c:\code\code_v2.4. Of note also is that when I try and just compile the default code, every other source file has a similar error (the compile halts on first error after trying control.c).

Also, I was trying to do this in the gui, maybe I should do it right and go command line?

UPDATE:
Now the problem is that compiler cannot find stdio.h. What is stdio used for in this code (i.e. is it just used for printf and such)?

Astronouth7303
28-01-2005, 19:13
Primarily printf(), but could be used for other things. Go to the project build settings amd set the directories to "suite defaults" (there's a button).

ElGeeko
29-01-2005, 17:39
I had already tried that to no avail.

Astronouth7303
29-01-2005, 18:39
Can you give us the exact error message?

ElGeeko
30-01-2005, 00:49
Can you give us the exact error message?

It was a few posts before, only there wasn't a line specifically for stdio.



Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "c:\mcc18\bin\mcc18.exe" -p=18F8520 "control.c" -fo="c:\code\code_v2.4\control.o" /i"C:\Dev-Cpp\include" /i" c:\code\code_v2.4" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
c:\code\code_v2.4\control.c:11: unable to locate 'stdio.h'
c:\code\code_v2.4\control.c:12: unable to locate 'ifi_aliases.h'
c:\code\code_v2.4\control.c:13: unable to locate 'ifi_default.h'
c:\code\code_v2.4\control.c:14: unable to locate 'ifi_utilities.h'
c:\code\code_v2.4\control.c:15: unable to locate 'user_routines.h'
c:\code\code_v2.4\control.c:16: unable to locate 'user_Serialdrv.h'
c:\code\code_v2.4\control.c:17: unable to locate 'user_routines.c'
error 1 spawning c:\mcc18\bin\cpp18
Halting build on first failure as requested.
BUILD FAILED: Fri Jan 28 00:07:44 2005

Mark McLeod
30-01-2005, 13:15
It was a few posts before, only there wasn't a line specifically for stdio.I notice you haven't corrected your typo. There's no such thing as a blankC drive.

You should probably go back to the defaults and get it compiling before you attempt to redirect everything.
In MPLAB go to Project -> Build Options... -> Project and clear all fields (and I mean ALL fields) except for Include Path (C:\mcc18\h) and Library Path (C:\mcc18\lib).
You can also hit "Suite Defaults" to clear them for you, but make sure you have the Include Path C:\mcc18\h (no blanks).
Don't add anything else.

ElGeeko
30-01-2005, 23:33
I did fix the error you talked about (I just copied and pasted from the other post). I do know about there being no blank c drive ;)

Everything (but lib and inc, which are set correctly) is already blank. Still nothing.

Mark McLeod
31-01-2005, 09:26
I did fix the error you talked about (I just copied and pasted from the other post). I do know about there being no blank c drive ;)



Everything (but lib and inc, which are set correctly) is already blank. Still nothing. Odd. The blankC is still there in your compile listing ( /i"C:\Dev-Cpp\include" /i" c:\code\code_v2.4), and the include setting for c:mcc18/h is not. I hope you didn't copy and paste from my post. That just highlighted the "blank" error.Executing: "c:\mcc18\bin\mcc18.exe" -p=18F8520 "control.c" -fo="c:\code\code_v2.4\control.o" /i"C:\Dev-Cpp\include" /i" c:\code\code_v2.4" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Can you compile the default 2.4 code?

You show several paths that are not part of the MPLAB default settings, so I assume you set them up. Are you using the "Use Alternate Settings" in MPLAB look under Project -> Build Options... -> Project, then the MPLAB C18 tab? If you are then add the c:mcc18/h path there as well.

Your compile line should look like:
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "main.c" -fo="main.o" /i"c:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERAIf you cannot get the mcc18/h path into the compile statement you might consider uninstalling MPLAB IDE and reinstalling it.

Plloyd
03-02-2005, 23:57
I am also having a problem with printf_lib.h

I can compile the default code, however, if i add the printf_lib.h and .c files that are in the default code directory, and attempt to use the printf function, it gives me the following error:

[path]\printf_lib.h:15:Error [1109] type mismatch in redeclaration of 'printf'

I am using v2.4 of the compiler (new computer - old version was never installed), and my build paths are all correct.

The error occurs whenever i include the printf_lib.h file
(ie, i can delete #include "printf_lib.h" and it will compile perfectly... put it back and i get the same error again).

Any help would be greatly appreciated.

Thanks,
Plloyd

Mark McLeod
04-02-2005, 07:38
I am also having a problem with printf_lib.h

I can compile the default code, however, if i add the printf_lib.h and .c files that are in the default code directory, and attempt to use the printf function, it gives me the following error:

Don't include the printf_lib.h or printf_lib.c files. They are old and no longer necessary.
The new compiler comes with a new printf routine. Adding the old printf routine on top of the default one caused the compiler to get confused about which of the two it should use.

Instead, add:
#include <stdio.h>
to any file that needs to use printf.

Plloyd
04-02-2005, 18:21
Thanks Mark,
that worked beautifully.