This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

_MSC_VER defined but not during build

I am using MDK-ARM V5.37 with arm compile V5 and have noticed that _MSC_VER is defined until I perform a build at which point it becomes undefined.

I have no idea where/why it is defined, it certainly isn't in my code.  I don't understand why it is defined and then becomes undefined at the point I perform a build.

It can easily be demonstrated in "main.c" as follows:

#if defined(_MSC_VER) && _MSC_VER >= 1700
int a = 1;
#endif

int main(void)
{
  int b = a;

  /* Infinite loop */
  while (1)
  {
  }
}

The Dynamic Syntax Checker is happy with the code and "int a = 1;" is not greyed out, implying _MSC_VER is defined.

Now compile the code and it gives error in main() stating that "a" is undefined.

This only happens when configured for arm compiler V5.  When configured for arm compiler V6 "int a = 1;" is greyed out and _MSC_VER is not defined before/during build.