This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error[e46] Undefined external error with functions in header files I've included

Other Parts Discussed in Thread: TIMAC, CC2530

I'm building off the CC2530 Software Examples to make a simple code that will transmit my own packets over BasicRF.  I'm still new to C-language and hope to develop TIMAC stuff later on, but for now, I'm just sticking with BasicRF.

Anyways, I'm using light_switch stuff and the basic_rf API as a reference and I got a code that fully compiled, but I'm getting problem in the linker.  My code is as follows:

______________________________________________________________

#include <ioCC2530.h>

#include <basic_rf.h>

#include "hal_rf.h"

#include "hal_mcu.h"

#include <hal_assert.h>

#define RF_CHANNEL                25      // 2.4 GHz RF channel

// BasicRF address definitions

#define PAN_ID                0x2007

#define MY_ADDR               0x2520

#define APP_PAYLOAD_LENGTH        1

#define DONGLE                0xBEEF

static uint8 pTxData[APP_PAYLOAD_LENGTH];

static basicRfCfg_t basicRfConfig;

int main(void)

{ int a;

  halBoardInit();

    basicRfConfig.panId = PAN_ID;
    basicRfConfig.channel = RF_CHANNEL
    basicRfConfig.ackRequest = TRUE;

for(a=0;a<100;a=a+1)  //Creating loop 0-100  line 40

{

    pTxData[0] = a;

    // Initialize BasicRF

    basicRfConfig.myAddr = MY_ADDR;

    if(basicRfInit(&basicRfConfig)==FAILED) {

      HAL_ASSERT(FALSE);

    }

    basicRfSendPacket(DONGLE, pTxData, APP_PAYLOAD_LENGTH);

}

}

___________________________________________________________

However, I'm getting Error[e46] as follows:

Error[e46]: Undefined external "halBoardInit::?relay" referred in MYCODE
Error[e46]: Undefined external "basicRfInit::?relay" referred in MYCODE
Error[e46]: Undefined external "halAssertHandler::?relay" referred in MYCODE
Error[e46]: Undefined external "basicRfSendPacket::?relay" referred in MYCODE

I tried everything I could find that seemed reasonable on this forum already so now I'm asking for help.  

The functions ARE in the header files! How are they undefined???

Please help as it is the only thing keeping my code from entering Debug mode now!!!

 

  • Hello Joseph, 

    Only the header file definitions are not enough unless the function declaration are defined somewhere else in your code. Search for the files which contain these functions in your windows explorer window and make sure that the files are included in your project.