搜索
bottom↓
回复: 2

undefined reference to `_conf_os

[复制链接]

出0入0汤圆

发表于 2014-10-30 13:49:42 | 显示全部楼层 |阅读模式
本帖最后由 wirelessgo 于 2014-10-30 13:50 编辑

出现这个问题 涉及到3个文件

main.c 内容:
#include <p33FJ32MC204.h>

#include "conf_bit.h"
#include "conf_osc.h"
#include "car_rtdm_test.h"

#include "RTDM.h"
#include "RTDMUSER.h"



int main(){

conf_osc();
conf_bit();

test_rtdm();

return 0;

}


conf_bit.h
#ifndef CONF_BIT_H
#define CONF_BIT_H

extern int conf_bit(void);

#endif /* CONF_BIT_H*/


conf_bit.c
#include <p33FJ32MC204.h>
#include "conf_bit.h"

extern int conf_bit(void){

/* 配置位信息 */

/******************************************************************************/
/* Configuration bits                                                         */
/******************************************************************************/

_FOSCSEL(FNOSC_FRCPLL);         // Start with FRC will switch to Primary (XT, HS, EC) Oscillator with PLL
_FOSC(FCKSM_CSECMD  & OSCIOFNC_ON & POSCMD_NONE);   // Clock Switching Enabled and Fail Safe Clock Monitor is disable
                            // Primary Oscillator Mode: XT Crystal
//_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF  & POSCMD_NONE);


_FBS (BSS_NO_FLASH & BWRP_WRPROTECT_OFF);
/* no Boot sector and
   write protection disabled */

_FWDT (FWDTEN_OFF);
/* Turn off Watchdog Timer */

_FGS (GSS_OFF & GCP_OFF & GWRP_OFF);
/* Set Code Protection Off for the General Segment */

_FPOR (PWMPIN_ON & HPOL_ON & LPOL_OFF & FPWRT_PWR128 );
//_FPOR (PWMPIN_ON & HPOL_ON & LPOL_OFF & FPWRT_PWR128 &ALTI2C_OFF);
/* PWM mode is Port registers
   PWM high active high& low active low
   alternate I2C mapped to SDA1/SCL1
   FPOR power on reset 128ms
   I2C mapped to SDA1/SCL1*/        //Add by hua 2014-9-1

_FICD (ICS_PGD3 & JTAGEN_OFF);
/* Use PGC3/PGD3 for programming and debugging
   JTAG Enable Bit: JTAG is disabled
   */
   
   return 0;
}


现在编译报错:
build/default/production/_ext/1445274692/main.o(.text+0x2): In function `.LSM1':
: undefined reference to `_conf_osc'
build/default/production/_ext/1445274692/main.o(.text+0x4): In function `.LSM2':
: undefined reference to `_conf_bit'
make[2]: *** [dist/default/production/rtdm.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:148: recipe for target 'dist/default/production/rtdm.X.production.hex' failed
make[2]: Leaving directory 'E:/kp/soft/soft_git/dspic/prj/rtdm.X'
nbproject/Makefile-default.mk:75: recipe for target '.build-conf' failed
make[1]: Leaving directory 'E:/kp/soft/soft_git/dspic/prj/rtdm.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 2s)

出0入0汤圆

发表于 2014-10-30 13:53:47 | 显示全部楼层
undefined reference to XXX  问题,找不到函数定义

出0入0汤圆

 楼主| 发表于 2014-10-30 14:07:59 | 显示全部楼层
本帖最后由 wirelessgo 于 2014-10-30 14:11 编辑

好吧。是我的问题,没有把这两个.c文件加到项目中。 谢谢
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-5 04:28

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表