• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microchip Linker problem

Status
Not open for further replies.

twiart

New Member
hello guys,when i was trying to build my project,i got this Build error message..

Code:
Clean: Deleting intermediary and output files.
Clean: Deleted file "M:\12 CCP PWM\12 CCP PWM.o".
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F46K20 "12 CCP PWM.c" -fo="12 CCP PWM.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.20 (feature limited)
Copyright 1999-2005 Microchip Technology Inc.
This version of MPLAB C18 does not support the extended mode
and will not perform all optimizations.  To purchase a full
copy of MPLAB C18, please contact your local distributor or
visit buy.microchip.com.

Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" "C:\MCC18\lkr\18f46k20i.lkr" "12 CCP PWM.o" /u_CRUNTIME /o"12 CCP PWM.cof" /M"12 CCP PWM.map" /W
MPLINK 4.20, Linker
Copyright (c) 2008 Microchip Technology Inc.
Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.
Errors    : 1

Link step failed.
----------------------------------------------------------------------
Release build of project `M:\12 CCP PWM\12 CCP PWM.mcp' failed.
Thu Apr 16 14:34:41 2009
----------------------------------------------------------------------
BUILD FAILED
i have checked the path to file c018i.o was correct.

Anyone any clues?

The following link is my source code.i wonder it has something to do with that.

cl1p.net
 

3v0

Coop Build Coordinator
Forum Supporter
It would help to see you source code. But I can guess.

Your err msg is

Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.
That tells me the linker can not find main(). Either you program does not have a

Code:
void main(void)
or you forgot to include you .c file as a source file in the project.

3v0
 

smanches

New Member
Does the 18f look for void main(void); and not int main(void);?

I know there are a lot of inconsistencies between microchip tools, but this is getting ridiculous.
 

3v0

Coop Build Coordinator
Forum Supporter
Where did you see int main(void)

In general it does not make sense for main to return anything so it is void main(void)

But I think we have the answer.

In the build we see
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F46K20 "12 CCP PWM.c" -fo="12 CCP PWM.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.20 (feature limited)
and in the source file provided we see

Code:
/** I N C L U D E S **************************************************/
#include "p18f46k20.h"
#include "delays.h"
#include "12 CCP PWM.h"  // header file
#include "08 Interrupts.h"
The code he provides (no name provided for the file) is not part of the project. That is why it can not find main.
 

smanches

New Member
Using the C30 compiler it wants int main(void), not void main(void).

The C spec is to use int main(void), even though it doesn't really make sense for embedded stuff.
 

edeca

Active Member
Do you have any missing #endif or other pre-processor declarations?
 

twiart

New Member
3v0,

ya,you are right,the linker couldn't find the main.well how to fix that..?

edeca,

erm where is the pre-processor location located?
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top