Author Topic: Microchip C18 Linker Problem  (Read 15719 times)

0 Members and 1 Guest are viewing this topic.

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Microchip C18 Linker Problem
« on: January 19, 2008, 01:42:18 PM »
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: [Select]
#include <p18f4525.h>
#include "xlcd.h"

void main(void) {
Nop();
}

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


Anyone any ideas?

It think its something to do with the
Quote
'C:\MCC18\lib/c018i.o'
Whys this have a forward slash?
« Last Edit: January 19, 2008, 01:43:24 PM by hazzer123 »
Imperial College Robotics Society
www.icrobotics.co.uk

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Microchip C18 Linker Problem
« Reply #1 on: January 19, 2008, 01:57:39 PM »
i think your makefile (if you have one) is incorrect.

Code: [Select]
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
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.
« Last Edit: January 19, 2008, 01:58:51 PM by rgcustodio »
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Microchip C18 Linker Problem
« Reply #2 on: January 19, 2008, 02:11:15 PM »
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

Any help with that one?
Imperial College Robotics Society
www.icrobotics.co.uk

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Microchip C18 Linker Problem
« Reply #3 on: January 19, 2008, 02:20:30 PM »
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
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Microchip C18 Linker Problem
« Reply #4 on: January 19, 2008, 06:57:58 PM »
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.
Imperial College Robotics Society
www.icrobotics.co.uk

 


Get Your Ad Here