wirelessgo 发表于 2014-10-30 13:49:42

undefined reference to `_conf_os

本帖最后由 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: *** Error 255
make: *** [.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: Leaving directory 'E:/kp/soft/soft_git/dspic/prj/rtdm.X'
nbproject/Makefile-default.mk:75: recipe for target '.build-conf' failed
make: 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)

abszy 发表于 2014-10-30 13:53:47

undefined reference to XXX问题,找不到函数定义

wirelessgo 发表于 2014-10-30 14:07:59

本帖最后由 wirelessgo 于 2014-10-30 14:11 编辑

好吧。是我的问题,没有把这两个.c文件加到项目中。 谢谢
页: [1]
查看完整版本: undefined reference to `_conf_os