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.

CODECOMPOSER: Compiler error flagging Function declaration using uint16_t

Part Number: CODECOMPOSER

I'm working on porting an existing IAR design to CCSv20. The target is an MSP430F5432

The function call:

   void hal_ucBusyWait(uint16_t waitCycles)
 
generates an error message:
 
   #760: variable "uint16_t" is not a type name
 
and yet if I swap uint32_t for uint16_t I get no complaints.  What am I mising here?  It seems the compile not recognize uint16_t, but that doesn't make sense. It doesn't have to make sense to be true of course. 
 
Thanks in advance for any insight or diagnostic suggestions. 
 
 
 
 
  • The type name uint16_t is not a built-in type name like int or float.  It comes from the standard header file stdint.h. So the most likely solution is to #include <stdint.h>

    The same can be said of the type name uint32_t.  For your specific case, I don't know where it gets defined.  To investigate, use the option --gen_preprocessor_listing.  Search for it in the MSP430 compiler manual.  The output is a file with file extension .rl.  Search that file for uint32_t.  You will probably see that it gets defined outside of stdint.h.  While not strictly illegal, that is poor programming practice.

    Thanks and regards,

    -George