Software > Software

Microchip C18 Linker Problem

(1/1)

hazzer123:
I am trying to control an LCD module with a PIC18F4525, using the XLCD for C module from application maestro. It didn't work with my previous project, so i started a new bare minimum one. And it still doesn't work.

The code i have in my main.c is this -

--- Code: ---#include <p18f4525.h>
#include "xlcd.h"

void main(void) {
Nop();
}
--- End code ---

The output from build is this -

--- Quote ---Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F4525  /i"C:\MCC18\h" "xlcd.c" -fo="xlcd.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited:  54
K:\Mplab\xlcd2\xlcd.c:552:Warning [2053] return value expected
K:\Mplab\xlcd2\xlcd.c:564:Warning [2053] return value expected
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" /k"C:\MCC18\lkr" "C:\MCC18\lkr\18f4525i.lkr" "K:\Mplab\xlcd2\xlcd.o" "C:\MCC18\lib\p18f4525.lib" /o"xlcd2.cof" /M"xlcd2.map" /W
MPLINK 4.15, Linker
Copyright (c) 2007 Microchip Technology Inc.
Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.
Errors    : 1

Link step failed.
BUILD FAILED: Sat Jan 19 19:42:20 2008


--- End quote ---

Anyone any ideas?

It think its something to do with the
--- Quote --- 'C:\MCC18\lib/c018i.o'
--- End quote ---
Whys this have a forward slash?

rgcustodio:
i think your makefile (if you have one) is incorrect.


--- Code: ---Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" /k"C:\MCC18\lkr" "C:\MCC18\lkr\18f4525i.lkr" "K:\Mplab\xlcd2\xlcd.o" "C:\MCC18\lib\p18f4525.lib" /o"xlcd2.cof" /M"xlcd2.map" /W
--- End code ---

the above seems to be the call to the linker command. the linker is passed several object files and then links all of these files to generate your application. the above shows that xlcd.o is being included in the link, also the p18f4525.lib is also being pulled in, but the object file where the main() function is not being pulled in. try to edit/fix you makefile or your settings so that main.o is being compiled and is being pulled in by the linker.

hazzer123:
Sorry yeah that was a silly mistake, and i just fixed it.

But now i get back another error.


--- Quote ---Clean: Deleting intermediary and output files.
Clean: Deleted file "K:\Mplab\xlcd2\xlcd.o".
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F4525  /i"C:\MCC18\h" "xlcd.c" -fo="xlcd.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited:  54
K:\Mplab\xlcd2\xlcd.c:552:Warning [2053] return value expected
K:\Mplab\xlcd2\xlcd.c:564:Warning [2053] return value expected
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F4525  /i"C:\MCC18\h" "main.c" -fo="main.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited:  54
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" /k"C:\MCC18\lkr" "C:\MCC18\lkr\18f4525i.lkr" "K:\Mplab\xlcd2\xlcd.o" "K:\Mplab\xlcd2\main.o" "C:\MCC18\lib\p18f4525.lib" /o"xlcd2.cof" /M"xlcd2.map" /W
MPLINK 4.15, Linker
Copyright (c) 2007 Microchip Technology Inc.
Error - could not find definition of symbol 'XLCDDelay4ms' in file 'K:\Mplab\xlcd2\xlcd.o'.
Errors    : 1

Link step failed.
BUILD FAILED: Sat Jan 19 20:11:40 2008
--- End quote ---

Any help with that one?

rgcustodio:
Your compiler/linker is just saying that it can't find the function "XLCDDelay4ms" anywhere (in the object files you used, or in the library you're pulling in during the link phase).

1) make sure the function name is correct, ie no typographical errors
2) try to find who find the definition of "XLCDDelay4ms" in your source and check if it is being conditionally compiled, ie the code is inside a #ifdef

HTH

hazzer123:
Thankyou for your help.

In the end the solution was simple - the lcd delay functions were prototyped, but not defined. Defining is left to the programmer.

Navigation

[0] Message Index

Go to full version