Jump to content

Recommended Posts

Hi,

I'm a new user to the SourceBoost C compiler, so sorry about this basic problem. The code below is giving me the error message "Unresolved external function" at build time for the 'memcmp' library function. Can anyone help please. ;)

 

Thanks

 

Alastair

 

#include <system.h>

#include <memory.h>

#pragma CLOCK_FREQ 8000000

#define LED latd.1

char data1[256];

char buffer1[256];

 

 

void main(void){

 

if(memcmp(data1,buffer1,256))

{

LED=1;

delay_ms(150);

LED=0;

delay_ms(150);

}

}

Share this post


Link to post
Share on other sites
Hi,

I'm a new user to the SourceBoost C compiler, so sorry about this basic problem. The code below is giving me the error message "Unresolved external function" at build time for the 'memcmp' library function. Can anyone help please. ;)

 

Thanks

 

Alastair

 

#include <system.h>

#include <memory.h>

#pragma CLOCK_FREQ 8000000

#define LED latd.1

char data1[256];

char buffer1[256];

 

 

void main(void){

 

if(memcmp(data1,buffer1,256))

{

LED=1;

delay_ms(150);

LED=0;

delay_ms(150);

}

}

 

Are you using MPLAB or the SourceBoost IDE? If you are using MPLAB make sure you are linking with the library file, it is not included automatically like with the SourceBoost IDE. memcmp should be in libc.pic16.lib (or libc.pic18.lib if you are using a 18Fxxx.) To add the library, in the project window, right click on the "Library Files" folder and select "Add File..." and browse to the SourceBoost/lib directory and select the correct library for your PIC.

 

Hope that helps,

 

RJS

Share this post


Link to post
Share on other sites

Alastair,

 

Note that length is also an unsigned char, so you will compare zero bytes using 256.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...