Thread: MSVC 'string' syntax highlighting like 'char, int, void'.

  1. #1
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003

    MSVC 'string' syntax highlighting like 'char, int, void'.

    How do I get msvc to highlight the datatype 'string', as 'char, int and void', for example, are highlighted by default. I've heard it is something to do with usertype.dat, but i've been unable to find or generate such a file.


    That is for .net, but I am using 6.0, I cant find the 'tool options' dialogue specified in the last stages of the tutorial...

    Many thanks.
    Last edited by xconspirisist; 06-29-2005 at 03:35 AM.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Northern Virginia/Washington DC Metropolitan Area
    As far as I know you can't make the STL string container data type itself be highlighted (I could be wrong). You can make your text strings themselves be highlighted differently, i.e. anything within double or single quotes. To do that you do the following:

    1. Go to "Tools" Menu
    2. Select "Options"
    3. Select the "Format" tab (It's the rightmost tab)
    4. Under the "Category" box select either "All Windows" or "Source Windows"
    5. Under the "Colors" box, find/select the "String" entry
    6. Select a foreground/background color from the appropriate boxes
    7. See the sample under the "Sample" box and click the OK button when you're happy with the results
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Yeah you can sort of. change the format for Identifier. I think they look pretty as a kinda claret colour. And follow the "add a user defined keyword" help page to add a udk for std::string and std::vector etc. then format udk's a nice colour too.
    Last edited by Stoned_Coder; 06-29-2005 at 06:19 AM.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

  4. #4
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Could you please step me through creating a "UDK", I dont have the MSDN help library avalible, and a few searchs at didnt turn up anything refuitible.

    Thanks hk_mp5kpdw, I was looking for the string datatype as you suggestied:

    #include <string>
    #include <iostream>
    int function main ( void ) {
    	char one;
    	string two; // would like to highlight 'string', as a datatype in this line.
    	int three;
    	cout << one << two << three << endl;
    	return 0;
    Wonder if that would compile?

    Thanks for any help, and thanks again for help given so far.

  5. #5
    Registered User
    Join Date
    Jan 2005

    There is the online version. Scroll to the part about user defined keywords. It is very easy. I put the usertype.dat file in <InstallDir>\Common\MSDev98\Bin. I tried std::string, but that didn't work (it highlighted std). So I tried string by itself and it worked perfectly. Make sure you close and re-open MSDev after you save the changes to the file.

  6. #6
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Thank you dearly, that worked a treat

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. Can't Find Conio.h?
    By drdroid in forum C++ Programming
    Replies: 27
    Last Post: 09-26-2002, 04:24 AM