Jump to content
Sign in to follow this  
Mac

What Library For '%' (modulo) Operator To Work?

Recommended Posts

Using MPLAB v8.5 IDE and BoostC v6.97 and when I add an instruction using the modulo '%' operator I get the following error;

 

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external symbol, function:__rem_8_8

 

What other file should I "include" besides "system.h" at the top of my source file, please?

 

TIA, Mike

Share this post


Link to post
Share on other sites
Using MPLAB v8.5 IDE and BoostC v6.97 and when I add an instruction using the modulo '%' operator I get the following error;

 

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external symbol, function:__rem_8_8

 

What other file should I "include" besides "system.h" at the top of my source file, please?

 

TIA, Mike

 

The % operator as well as few others need the libc library linked to your project. If you work from SourceBoost IDE this library will be added automatically. If you use MPLAB you need to add it manually (libc.pic16.lib for PIC16 targets, libc.pic16x.lib for new pic16f1x and libc.pic18.lib for PIC18). This library can be found in the lib folder inside SourceBoost installation directory.

 

#include <system.h> should be the first include in all your source files.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
Using MPLAB v8.5 IDE and BoostC v6.97 and when I add an instruction using the modulo '%' operator I get the following error;

 

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)'

Error: Unresolved external symbol, function:__rem_8_8

 

What other file should I "include" besides "system.h" at the top of my source file, please?

 

TIA, Mike

 

The % operator as well as few others need the libc library linked to your project. If you work from SourceBoost IDE this library will be added automatically. If you use MPLAB you need to add it manually (libc.pic16.lib for PIC16 targets, libc.pic16x.lib for new pic16f1x and libc.pic18.lib for PIC18). This library can be found in the lib folder inside SourceBoost installation directory.

 

#include <system.h> should be the first include in all your source files.

 

Regards,

Pavel

 

 

Found an interesting feature/bug!!. If you compile a program that uses modulo (%) (also has system.h) and use the libc.pic18.lib, then everything compiles fine.

 

But, if you have an array that is greater than 100, then the compiler says use the -idx 2 switch for the compiler (you also have to do this for the linker). But when it tries to link, it fails on the unresolved external function __rem_8_8().

 

So if you want to use modulo, don't use arrays bigger than 100!

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...
Sign in to follow this  

×
×
  • Create New...