This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM642 the error: symbol is defined multiple times



Hi, all

             I do some image processing in CCS 2.21 on evmDM642. There happened a very strange problem. I list it in the below:

            #ifndef _ICETEC_DM642_H_
            #define _ICETEC_DM642_H_

           #pragma DATA_SECTION(nMemTemp_cb, ".INTPROCBUFF");
           #pragma DATA_ALIGN(nMemTemp_cb,128);
           unsigned char nMemTemp_cb[360];

           #endif

          this is file: ICETEK-DM642-PCI.h

          In the ICETEK-DM642-PCI.c and video.c, I include this head file such as #include "ICETEK-DM642-PCI.h"  respectively.But  When I compile the project

         the compiler list the:

       [Linking...] "c:\ti\c6000\cgtools\bin\cl6x" -@"Debug.lkf"
        >>   error: symbol _nMemTemp_cb is defined multiple times:
            C:\ti\vidio_test\face_detect_2\Debug\ICETEK-DM642-PCI.obj and
            C:\ti\vidio_test\face_detect_2\Debug\video.obj

        when I remove the "ICETEK-DM642-PCI.h" from the ICETEK-DM642-PCI.c,and replace it with extern unsigned char nMemTemp_cb[360];  Compiling passed!

        Why? How is it happened?

 

 

  • jun wang said:
    Why? How is it happened?



    I suspect that the two c files both reference nMemTemp_cb somewhere inside them, which could be leading to it being implicitly defined, since in the second c file built, the #ifndef would fail and the declaration statement unsigned char nMemTemp_cb[360]; would not exist. I think you want the header to say something like the below.

                #ifndef _ICETEC_DM642_H_
                #define _ICETEC_DM642_H_

               #pragma DATA_SECTION(nMemTemp_cb, ".INTPROCBUFF");
               #pragma DATA_ALIGN(nMemTemp_cb,128);
               unsigned char nMemTemp_cb[360];

               #elseif

               extern unsigned char nMemTemp_cb[360];

               #endif

    This would guarantee that nMemTemp_cb is always given a proper declaration in either c file and should prevent you from getting inadvertent implicit declarations.

  • You actually do define

    unsigned char nMemTemp_cb[360];

    two times, which is not legal.  Build both C files with the option -ppc and look at the resulting .pp files.  You will see it.  In a header file you must write intead

    extern unsigned char nMemTemp_cb[];

    It is OK to for a declaration like that to appear multiple times.

    Any C compiler would complain about this error.  So I'm sure a good discussion of this is somewhere in the C FAQ http://www.eskimo.com/~scs/C-faq/top.html .  But it seems to be down right now.

    Thanks and regards,

    -George