Skip to main content
ebotsmith
Associate
October 31, 2013
Question

COMPILATION PROBLEM - "symbol multiply defined"

  • October 31, 2013
  • 2 replies
  • 5979 views

Posted on October 31, 2013 at 10:13

 

 

 

I am using STM8S 105C^Discovery with a Windows 8 Laptop. I tried to compile some example codes using Cosmic C Compiler with an Evaluation Key, but I got some errors.

 

 

Here is the message I got

 

=========================================================

 

 

 

----------- Project pwm - STM8 Cosmic - Configuration Debug -------------

 

 

 

Compiling fwlib\project\stm8s_it.c...

 

cxstm8 +mods0 +debug -pxp -no -pp -l -dSTM8S105 -ifwlib\project -ifwlib\library\inc -i''C:\Program Files\COSMIC\CXSTM8_EVAL\Hstm8''  -clDebug\ -coDebug\ fwlib\project\stm8s_it.c

 

fwlib\project\stm8s_it.c:

 

 

 

Compiling stm8_interrupt_vector.c...

 

cxstm8 +mods0 +debug -pxp -no -pp -l -dSTM8S105 -ifwlib\project -ifwlib\library\inc -i''C:\Program Files\COSMIC\CXSTM8_EVAL\Hstm8''  -clDebug\ -coDebug\ stm8_interrupt_vector.c

 

stm8_interrupt_vector.c:

 

 

 

Running Linker

 

clnk -m Debug\pwm.map -l''C:\Program Files\COSMIC\CXSTM8_EVAL\Lib''  -o Debug\pwm.sm8 Debug\pwm.lkf 

 

#error clnk Debug\pwm.lkf:71 Debug\stm8_interrupt_vector.o: symbol f_NonHandledInterrupt multiply defined (Debug\stm8s_it.o)

 

 The command: ''clnk -m Debug\pwm.map -l''C:\Program Files\COSMIC\CXSTM8_EVAL\Lib''  -o Debug\pwm.sm8 Debug\pwm.lkf '' has failed, the returned value is: 1

 

exit code=1.

 

 

 

pwm.elf - 3 error(s), 0 warning(s)

 

 

 

 

==============================================

 

 

I would appreciate if some one can advice me on how to solve this problem

    2 replies

    Dmitriy Kozubenko
    Visitor II
    May 31, 2017
    Posted on May 31, 2017 at 22:18

    Maybe you don't include some files like as stm8sxxx_it.c, 

    stm8sxxx_it.h, stm8lxxx_conf.h

    I had the same problem, but when I add this files in my project, the problem is gone.

    Explorer
    July 9, 2024

    I have included all three files mentioned above, yet it didnt work at all.:frowning_face:

    Andrew Neil
    Super User
    July 9, 2024

    As @Maksim Salau said, the problem is that you've defined NonHandledInterrupt  in both stm8_interrupt_vector.c and stm8s_it.c

    You need to remove one of those definitions.

     

    PS

    "Multiply defined" is just a clumsy & ugly way of saying that you have multiple definitions of NonHandledInterrupt 

    PPS

    Note that the message would be easier to read if posted using the </> button - as for source code:

     

    =========================================================
    ----------- Project pwm - STM8 Cosmic - Configuration Debug -------------
    
    Compiling fwlib\project\stm8s_it.c...
    
    cxstm8 +mods0 +debug -pxp -no -pp -l -dSTM8S105 -ifwlib\project -ifwlib\library\inc -i''C:\Program Files\COSMIC\CXSTM8_EVAL\Hstm8'' -clDebug\ -coDebug\ fwlib\project\stm8s_it.c
    fwlib\project\stm8s_it.c:
    
    Compiling stm8_interrupt_vector.c...
    cxstm8 +mods0 +debug -pxp -no -pp -l -dSTM8S105 -ifwlib\project -ifwlib\library\inc -i''C:\Program Files\COSMIC\CXSTM8_EVAL\Hstm8'' -clDebug\ -coDebug\ stm8_interrupt_vector.c
    stm8_interrupt_vector.c:
    
    Running Linker
    clnk -m Debug\pwm.map -l''C:\Program Files\COSMIC\CXSTM8_EVAL\Lib'' -o Debug\pwm.sm8 Debug\pwm.lkf 
    
    #error clnk Debug\pwm.lkf:71 Debug\stm8_interrupt_vector.o: symbol f_NonHandledInterrupt multiply defined (Debug\stm8s_it.o)
    
    The command: ''clnk -m Debug\pwm.map -l''C:\Program Files\COSMIC\CXSTM8_EVAL\Lib'' -o Debug\pwm.sm8 Debug\pwm.lkf '' has failed, the returned value is: 1
    exit code=1.
    
    pwm.elf - 3 error(s), 0 warning(s)
    
    ==============================================

     

     

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Maksim Salau
    Associate
    June 1, 2017
    Posted on June 01, 2017 at 13:38

    Hi,

    The message says that you have NonHandledInterrupt defined in two files:

    stm8_interrupt_vector.c and stm8s_it.c

    Just remove one of them.

    Maksim.