26

My code compiles and runs just fine (so far...), however, because Visual Studio's Intellisense doesn't yet support the C++11 features new to the 2012 CTP's compiler:

Having chunks of perfectly good (albeit experimental) code underlined red tends to throw me off a bit. Is there a way to tell Intellisense to ignore errors in specific places?

Can someone recommend an IDE that already offers proper syntax highlighting and checking for these new features (specifically, delegating constructors, initializer lists and variadic templates, these are the ones that got me hooked)?

Community
  • 1
  • 1
Janusz Syf
  • 393
  • 2
  • 4
  • 11

3 Answers3

68

Go to:

Tools->Options->Text Editor->C/C++->Advanced->Intellisense

and set "Disable Error Reporting" to true.

edwinc
  • 1,658
  • 1
  • 14
  • 14
  • 1
    I've also written [an extension that does this for you automatically](http://visualstudiogallery.msdn.microsoft.com/7c43abba-08ad-4b92-aa83-710ff9f9bd90?SRC=Home). – Chris Kline May 01 '14 at 13:08
  • Absolutely useful for Firmware developers (e.g. Using AVR but Visual Studio) ;-) Thanks a lot! – hfrmobile Jun 05 '14 at 08:11
  • 8
    This is a useful tip to disable Intellisense, but does not answer the actual question. The question itself is actually very good while trying to define a tough situation. –  Nov 05 '14 at 15:55
  • thanks @edwinc! great information that avoid to make me crazy! – ghiboz Feb 18 '15 at 12:54
  • 2
    this disables the intellisense false positives but also disables the markings of the correct errors reported by the compiler – vlad_tepesch Jan 24 '19 at 09:57
13

I'm quite confident you cannot do that.

The CTP independently updates the compiler only, not Intellisense. Intellisense is based on EDG's front-end, which the CTP does not update (even regardless of the CTP, Intellisense and the compiler might disagree at times because of this). See also this Q&A on SO for a clarification.

You can, of course, disable Intellisense completely, but I don't think that's what you were asking for.

Community
  • 1
  • 1
Andy Prowl
  • 124,023
  • 23
  • 387
  • 451
  • 6
    You can also disable error underlining and leave IntelliSense enabled (for autocompletion, etc.). – ildjarn Feb 05 '13 at 19:07
  • @ildjarn: I didn't know that. Please feel free to edit my answer then. – Andy Prowl Feb 05 '13 at 19:21
  • That answer is simply wrong: Tools > Options > Text Editor > C/C++ > Advanced > IntelliSense – hfrmobile Jun 05 '14 at 08:10
  • @hfrmobile: No, it's not. The OP wants to "*tell Intellisense to ignore errors **in specific places***" and have "*proper syntax highlighting and checking **for these new features***" and there is just no way to do that with that CTP. Please consider withdrawing your downvote. – Andy Prowl Jun 05 '14 at 09:32
  • 1
    There is a way to suppress IntelliSense errors. It's fine for me. – hfrmobile Jul 07 '14 at 06:24
  • @hfrmobile: The fact that it's fine *for you* does not make my answer "simply wrong". Read the question, possibly beyond its title. – Andy Prowl Jul 07 '14 at 07:44
  • It can be done by method provided by edwinc, at least in VS2012 – Jichao Jul 11 '14 at 21:22
  • 3
    @Jichao: No, it cannot. You, like hfrmobile, have not read the question. I'll repeat that for you so you don't have to browse previous comments: the OP wants to "*tell Intellisense to ignore errors **in specific places***" and have "*proper syntax highlighting and checking **for these new features***" and there is just no way to do that with that CTP. Thanks for downvoting my correct answer. – Andy Prowl Jul 12 '14 at 00:32
  • 1
    The title and question says different things. You are right. I will upvote when I get chance. But stackoverflow won't allow me to unless your answer modified. – Jichao Jul 12 '14 at 02:32
  • @Jichao: It's OK, I don't need the upvote, it's enough if you will remove your downvote. If you can't, nevermind. Hopefully more users won't fall into the same trap. – Andy Prowl Jul 12 '14 at 02:58
  • hfrmobile's method works to an extent - it stops errors being reported. However it does this globally NOT just the section the original posted has problems with. –  Nov 05 '14 at 16:00
3

In VSCode you can use

#ifndef __INTELLISENSE__
    // ... code to ignore - for example ...
    __builtin_avr_delay_cycles(16 * 6 + 8); // converts to asm code
#endif

It does darken that code section in the editor, which is slightly annoying, but at least it doesn't report the errors and the section will compile in just fine.