Technical Support

GENERAL: CHECK USAGE OF SPECIFIC COMPILER VERSIONS


Information in this article applies to:

  • C51 All Versions
  • C166 All Versions
  • C251 All Versions
  • CARM All Versions
  • µVision Version 3

QUESTION

I know that I can setup a specific path to the toolchain which basically allows me to switch the tool chain version. This path setup is even stored in the *.UV2 project file. However, I would like to ensure that a specific toolset version is used for my project.

Can I check the version number in my source code?

ANSWER

You may use the predefined macro constant _ _ C51 _ _, _ _ CX51 _ _, _ _ C166 _ _, _ _ C251 _ _, or _ _ CA _ _ compiler

which returns the version number of the compiler. This version number can be verified using preprocessor directives as shown below:

#if (__C51__ < 700) || (__C51__ > 799)
 #error "Requires C51 Compiler V7.xx"
#endif

It is enough when just one C source module contains this version number check, since µVision is using the same compiler version for all compilation runs.

MORE INFORMATION

  • Refer to Predefined Macros in the Cx51 User's Guide.
  • Refer to Predefined Macros in the C166 User's Guide.
  • Refer to Predefined Macros in the C251 User's Guide, available on request from Technical Support (C251.pdf).
  • Refer to Predefined Macros in the CARM User's Guide.

SEE ALSO

Last Reviewed: Thursday, January 11, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure