简体   繁体   中英

Visual c++ express 2010 Highlighting

Visual C++ does not highlight userTypes by default like; vector or MyCustomType; I've gotten used to this in C# and am wondering is there some way to get it to highlight userTypes for c++. I have checked in the fonts and color settings; User Types is set to a color but it has no affect in the editor.

No, there is no way to do this in Visual Studio 2010.

The reason is probably because C++ is notoriously hard to parse and determining what tokens are class names would require a lot of processing. This was probably deemed impractical because it would be too slow, though I can only guess.

This absolutely CAN be done!

I do it all of the time with my C++ types because I have my own typedefs for any type which is not strictly defined (pretty much all of them). Defining my own types prevents future incompatibilities (or at least mitigates them), as well as helps with portability. However, it requires an extra step before the types are highlighted properly.

Simply create a plain text usertypes.dat file in the same directory as devenv.exe using a standard text editor.

Put one type name on each line.

Then restart the IDE.

There is also a tool that manages this if you have complex needs that can be found at:

http://msmvps.com/blogs/p3net/archive/2010/06/27/updateusertype-visual-studio-addin.aspx

I used to use Visual Assist X for highlighting and intellisense while coding C++ projects that use a lot of templates.. This used to help me quite a bit.

http://www.wholetomato.com/downloads/

You could give it a try. But I must say it relatively reduces the speed of VS. Install the free trial and if you don't like it you can always remove it..!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM