当我试图在MPLAB中构建我的项目时,我得到了这个构建错误消息。
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我已经检查到链接器库的路径是否正确,我怀疑这与我的源码有关,非常感谢code...Any的帮助。
这是我的源代码..http://cl1p.net/mplabc18
发布于 2009-04-18 16:57:51
编译器可能正在寻找main的不同定义。我在一些PIC代码中看到过:
// Main application entry point.
#ifdef __C30__
int main(void)
#else
void main(void)
#endif
{ ... }发布于 2009-04-19 14:26:14
在您的源文件中,唯一让我印象深刻的是ISR声明的这一部分:
#pragma code InterruptVectorLow = 0x18
您正在使用的编译器的用户指南指出这应该是:
#pragma code low_vector=0x18
因为这个声明恰好在main函数之前,所以它可能会给您带来麻烦。
编辑:
所展示的解决方案似乎都不起作用,所以我只是将您的代码复制粘贴到一个新的MPLAB项目中,该项目是为PIC18F46K20设备设置的。它可以用MCC18编译器编译得很好。项目中唯一缺少的是“12CCP PWM.h”头文件(我没有)。所以要么是你的头文件有问题,要么是你的项目设置有问题,要么就是我用的是MCC18 3.30而不是3.20。
发布于 2009-04-20 18:56:25
最好将特定的链接器文件添加到项目中。如果您使用的是MPLAB,在工作区下,右键单击链接器文件,然后从mcc16\lkr文件夹添加特定处理器的链接器文件。清理并重新编译解决方案
https://stackoverflow.com/questions/761084
复制相似问题