Visual Studio 2010 Changes for VC++ (part 2)

In my previous post I talked about the new build system for VC++ from Visual Studio 2010, which is MSBuild and the support for multi-targetting. In this post I will talk about changes to IntelliSense and browsing.

If you go back to the example I was providing in the first post, with the two identical projects created with Visual Studio 2008 and Visual Studio 2010, a second important thing to notice in the comparison of the two solution is that the infamous .NCB file is no longer present in Visual Studio 2010 solution. Instead there is a new file with extension .SDF. This is not just a renaming of the extension, the entire Intellisense for Visual C++ was redesigned in Visual Studio 2010. This is a SQL Server Database file, possible to be opened even in Visual Studio (if one wants to check its content).

In the previous versions of Visual C++, each time you modified a header, the entire solution was reparsed, in which time it was very hard to use the environment. Moreover, the IntelliSense database file (the .NCB file) never seem to shrink, only increased in size, and it could get corrupted from time to time. In the new version, files are parsed on the background, and the IDE does not read all the files, only the current translation unit (which is a source file and all the headers it includes directly and indirectly). As a result, the operation is much swifter and less error prone.

There is also a new disk folder called iPCH in the new solution. This is the storing location for IntelliSense support files and browsing database files (SDF).

#include auto completion

Part of the new IntelliSense and Browsing experience, the #include keyword supports auto-completion for the header files. That means that after typing #include, the IDE displays a list of available headers, filter by their name as you type. The following image shows this.

Call Hierarchy

This feature enables navigation through the code, showing the calls to and from a selected method, constructor or property. When selecting a call in the hierarchy window it shows the code where the call is made.

Red Squiggles

This is a feature that enables highlighting syntactic and semantic errors with a red squiggle line. Hovering the mouse over the line will show a balloon with the error message. The same error is also listed in the Error List window.

Find All References

In the previous versions, this features displayed only the compiler verified results for a search. If you searched for a function M member of a class C it only returned the references where function M was used in the context of C. The new version allows two types of search: one that is focus on speed, and returns all the matches for a symbol regardless the context (but it’s a narrowed search than the one performed with Find in Files), and one that is focused on accuracy and returns only the compiler verified results (i.e. the ones that match the search context).

Class Wizard

Yet another important change is the famous and acclaimed class wizard from VC6, that was dropped in Visual Studio 2002, and was now brought back in Visual Studio 2010.

If you are (or were) familiar with VC6 you know what the Class Wizard is. In Visual Studio 2010 it features basically the same functionality, except that it is improved with search functionality. You can search for command, messages, virtual functions, members or methods. This is great because might not know the exact name of a message or a function, but searching allows you to quickly get it with only typing part of the name. For those not familiar with VC6 this is a single point to add or remove commands, message handlers, virtual functions, member variables and methods. This was a favorite feature in VC6 for a lot of people and there was a constant pressure on Microsoft to bring it back, so here it is.

All these features are detailed in MSDN and on the VC++ Team blog. I suggest several additional readings:

4 Replies to “Visual Studio 2010 Changes for VC++ (part 2)”

  1. Hi Marius,

    Have you noticed that in VS2010 RTM, you will get red squigglies under #include if the file included resides in a directory other than the source file directory?

    Ex. If your headers are all in a \h directory which is included in the Include Directories (or additional include directories) for the Project.

    The project can build fine but intellisense parsing is unable to find the header file.

    I thought maybe you’ve encountered this and have a solution. If not, you may want to add a vote to my connect entry:

    https://connect.microsoft.com/VisualStudio/feedback/details/551093/intellisense-is-unable-to-locate-header-files-in-different-directory

    Cheers,
    John

  2. yes, i think too what MFC Class wizard is a great think.
    when it run..
    with my project, to add a new mfc class, i must wait for 3 minutes just for display the wizard, when he don’t crash.
    all think in vs2010 are the same, slow.
    compiling a project his à nightmare. minutes and minutes passed to wait.
    i have vc6 and vc2010 installed and can compare both.
    vc6 never angh or crash.
    they are made a great product, vc6. why they are so stupid to adandon this and make this stupid gas station?
    12 years for this??? god..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.