Skip to main content
Visitor II
November 4, 2011
Question

Linker problem ''symbol d_imul not defined''

  • November 4, 2011
  • 4 replies
  • 1032 views
Posted on November 04, 2011 at 01:51

I'm building a project for an STM8S208 using the Cosmic compiler (CXSTM8_32K) within ST Visual Develop.  When I link, I receive the error ''symbol d_imul not defined''.  The project was working well previously using only 8-bit operations, but I recently added some 16-bit multiplication operations.  Do I need to link in an additional math lib to support 16-bit (or 32-bit, for future reference) operations?

#stm8s-stm8s208-cosmic-stvd #stm8 #cosmic #math.h
    This topic has been closed for replies.

    4 replies

    Visitor II
    November 4, 2011
    Posted on November 04, 2011 at 11:46

    Hi,

    the general rule, as you have guessed, is that the most complex math you need, the more libraries you need to link: see page 280 of the user manual for more details.

    However, for your specific case, imul is part of the basic libm library, which is always linked, so your problem probably comes from the fact that you are linking code AFTER the libraries (with STVD this can happen, for example, if you write code in the file that contains the interrupt vectors).

    Regards

    Luca (Cosmic)

    Visitor II
    November 4, 2011
    Posted on November 04, 2011 at 14:27

    Your suspicion is correct - I had moved the interrupt vector table into a file with code... a lot of code.  This is unexpected behavior, but who works with embedded tools and doesn't come across at least three unexpected things before lunch daily.  I'll move the table out and give it another go.  Thanks for your assistance!

    Visitor II
    November 30, 2011
    Posted on November 30, 2011 at 15:42

    In my case the linker shows the same error with math.h library. I included it in main.c ( #include <math.h> ) but I get ''symbol _sqrt not defined (Debug\main.o )'' (I need sqrt function in my code)

    (Cosmic compiler CXSTM8_32K)

    I am using ST Visual Develop.

    Please help
    Visitor II
    December 1, 2011
    Posted on December 01, 2011 at 12:59

    The problem is solved by simply enabling the float libraries in the STVD linker (clink) options