IDIV Undefined

Hi All, I am getting the following error in code warrior while linking a small program. I am using HC08 edition. "L1822 : Symbol _IDIVS is undefined". My code is as follows. int i,j; i = i/j; I think the compiler generates the object code with the _IDIVS symbol. But the Linker is not able to link this symbol. I know, I can eliminate this by linking using ansi.lib file. But due to my memory size limitation, I can't use any lib files. So how to over ride this problem. Any idea?. Is there any compiler or linker settings is available to solve this problem?

Thanks in advance Shibu

Reply to
shibu
Loading thread data ...

  1. Don't use division.
  2. If you have to use it, consider multiplicating by reciprocal instead.
  3. If this doesn't fit, write your own _IDIVS function and link it in.

Vadim

Reply to
Vadim Borshchev

Your choices are:

1) Remove all division from your program. 2) Link in ansi.lib. 3) Write your own division routine and call that rather than using the / operator.

I would suggest option 2. If the only thing you are using in ansi.lib is _IDIVS (and CodeWarrior is a reasonable system for embedded development), that should be the only routine taken from the library. Any routine you write yourself is likely to be both larger and wrong.

Regards,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen

You can write your own _IDIVS function.

JJS

Reply to
John Speth

This looks rather strongly like an overly strong conclusion. You want that routine, and that library is where that routine is, so by all means you should use it.

Unless your toolset is broken beyond all imagination, which I'm quite sure it's not, just allowing it to use a library will not all by itself cause any waste of code memory. It's just a library, after all.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Unless you write a special-purpose assembly routine (maybe with the HC08's native 'DIV' instruction ,) you have to write or use a library

Reply to
Wade Hassler

Did you check what the linker includes besides _idivs ? If it only takes _idivs, I doubt you can do any better, except avoiding div !

--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
 Click to see the full signature
Reply to
42Bastian Schick

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.