Keil Logo

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

SEE ALSO

Last Reviewed: Thursday, January 11, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.