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.

"Incompatible redefinition of macro" warnings when compiling example code

Other Parts Discussed in Thread: MSP430F5529

Hello,

   I'm trying to compile the "OutOfBox_EmulStorageKeyboard" (16kb version) example code for the MSP430F5529 launchpad, and immediately after importing the project I get the following warnings.  It seems to stem from the fact that the definitions are found in both "\OutOfBox_EmulStorageKeyboards\driverlib\MSP430F5xx_6xx\deprecated\msp430f5xx_6xxgeneric.h" as well as "\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h".  How should I fix this?

"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 160: warning #48-D: incompatible redefinition of macro "LPM0" (declared at line 133 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 161: warning #48-D: incompatible redefinition of macro "LPM0_EXIT" (declared at line 134 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 162: warning #48-D: incompatible redefinition of macro "LPM1" (declared at line 135 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 163: warning #48-D: incompatible redefinition of macro "LPM1_EXIT" (declared at line 136 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 164: warning #48-D: incompatible redefinition of macro "LPM2" (declared at line 137 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 165: warning #48-D: incompatible redefinition of macro "LPM2_EXIT" (declared at line 138 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 166: warning #48-D: incompatible redefinition of macro "LPM3" (declared at line 139 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 167: warning #48-D: incompatible redefinition of macro "LPM3_EXIT" (declared at line 140 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 168: warning #48-D: incompatible redefinition of macro "LPM4" (declared at line 141 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")
"..\driverlib\MSP430F5xx_6xx\inc\../deprecated/CCS/msp430f5xx_6xxgeneric.h", line 169: warning #48-D: incompatible redefinition of macro "LPM4_EXIT" (declared at line 142 of "c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h")

  • Hello Michael,

    The incompatible redefintion occurs when there are two header files containing the offending macro. Remove the one which is not the superset header file

    Regards
    Amit
  • Removing the header file will generate new error's.

    In the header file "driverlib\MSP430F5xx_6xx\deprecated\CCS\msp430f5xx_6xxgeneric.h" comment out all the lines within the first "ifdef __ASM_HEADER__" with the LPM definitions.

  • Hello Leo,

    Since the following header file already has the definition
    c:\ti\ccsv6\ccs_base\msp430\include\msp430f5529.h

    You must exclude the other file.

    Regards
    Amit
  • Hello Amit,

    I know, normally you will do so but the Project specific file 'msp430f5xx_6xxgeneric.h' contains more (incompatible) definitions not declared in the (new) [MCU].h or any other header file.

    Then the easiest way is to remove the LPM definitions.

    Leo.
  • Thanks for the replies, but how do I exclude the file?  It's included by a library file, isn't it bad form to go editing the library files since they could be shared by other projects?  How do I make it not include both files without editing the library files?

  • MichaelH said:
    but how do I exclude the file?

    You can't mark a header file 'Excluded' (at least it doesn't work), you need to remove it and/or remove the references to it.

    MichaelH said:
    isn't it bad form to go editing the library files since they could be shared by other projects?

    No, the file is added to this project and only in use by this project.

  • I tried removing the files or the include statements, but when I do, something breaks. The only thing that seems to work is commenting out those lines in the msp430f5xx_6xxgeneric.h file. The library files may be copied over to the project in this case, but some projects will link to the library instead of copy the whole library over. Editing the library files seems contrary to how a library file should be used, and editing the file also makes it difficult to update the library if new versions are released. Shouldn't code be written so that you don't have to go editing library source files, and especially not reference something you've explicitly put in a folder named "deprecated"?
  • Hello Michael

    That is correct. They must be excluded, but a mix of DRM and Functions should be avoided in the application code.

    I handle the TM4C12x devices which have a similar structure. However when using the generic header file, we strongly discourage the use of Software library as it causes the same problem.

    In all likelihood it would not cause a problem, but then having a clean build ensures no future incompatibilities.

    Regards
    Amit
  • Amit,
    It looks like its "hw_memmap.h" that's calling the generic header, so it's the library itself that's calling the generic header file. I tried to replace the generic header file #include statement with the specific msp430f5529.h header file, but then it gives me a bunch of errors about "OFS_WDTCTL_L" being undefined, etc.

    So what is the correct way of using the hw_memmap.h file without using the deprecated generic include file?
  • Hello MichaelH,

    Are there any example codes in the MSP430 Software Installation. This is strange that something as basic as this is not given with examples!!!

    Regards
    Amit
  • The Project is created under an older version of CCS, but since TI has introduced ‘#include <msp430.h>’ in combination with a Project’s Configuration Predefined Symbol pointing to the actual MCU which results in a improved MCU header file, the use of ‘msp430f5xx_6xxgeneric.h’ is obsolete.

    This project is upgraded with ‘#include <msp430.h’ but not all source files takes full advances of this and uses ‘old’ definitions which were declared in the old ‘msp430f5xx_6xxgeneric.h’, therefore this old header file is added to the project as ‘deprecated’ and will never be (automatically) updated while it isn’t a Library file anymore. If you feel comfortable you might rename the header file to any name of your choice.
    I will never reference a header file or any other file from another project, if needed I will place these files in a Shared directory.

    If you take the time to update the project source files which using the old definitions (it’s only a few or maybe even only one) to these declared in the new header file, you can delete msp430f5xx_6xxgeneric.h, TI didn’t take this time.