question

MarkScott-9536 avatar image
0 Votes"
MarkScott-9536 asked MarkScott-9536 commented

Intellisense doesn't recognize __GNUC__ after upgrade to VS2019 16.9.0

After upgrading Visual Studio 2019 Pro from 16.8.5 to 16.9.2, my #ifdef GNUC code block is no longer recognized by Intellisense. I am working on an Azure Sphere solution. What setting do I need to change to get that functionality back? The code seems to run just fine when deployed to the sphere. Any guidance would be appreciated.

vs-general
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MarkScott-9536 , do you have any error messages? If possible, please share us some screenshots so that we investigate it further. In addition, you could try to repair your Visual Studio by running your VS installer > More > Repair.

0 Votes 0 ·

Anna. Thanks for following up. Just to be clear, there is no "error", per se, in VS. The issue is that GNUC (please see attached image) appears to no longer be recognized. Prior to the update it was purple and the code in that block was regular text. The code in the else block was greyed out (expected). I'll try the repair.

81632-image.png


0 Votes 0 ·
image.png (139.0 KiB)

Anna. I did not try the repair; however, I did remove VS 2019 and the Installer. I cleaned up according to this page and reinstalled VS 2019 Pro v16.8.7. Everything is back to working as expected. I don't know what the difference is with those releases but something changed in 16.9 that changed behavior.

0 Votes 0 ·

Maybe the “Show Inactive Block” option must be changed to True (menu, Tools, Options, Text Editor, C/C++, View)?

0 Votes 0 ·

Thank you for the suggestion. It was already set to True

0 Votes 0 ·

Do you expect __GNUC__ to be defined because you are using the specific compiler instead of MSVC?

As a workaround, try adding these lines to the shown file or to some common header file:

 #ifdef __INTELLISENSE__
 #   define __GNUC__
 #endif

Then IntelliSense should recognize ‘#ifdef __GNUC__’. But compiler will use the real definition of __GNUC__.

0 Votes 0 ·

Thanks for the info. We're using the Gnu compiler. This is an Azure Sphere project. Unfortunately, this breaks our test project. since that's how we're telling the code to use the Gnu compiler and the test project to use the VS C++ compiler.

0 Votes 0 ·

0 Answers