warning: C4786 identifier was truncated to '255' characters in the debug information

This is a discussion on warning: C4786 identifier was truncated to '255' characters in the debug information within the Windows Programming forums, part of the Platform Specific Boards category; I really REALLY hate VC++ 6.0!! But I'm stuck with it. From what I understand, there's no way to silence ...

  1. #1
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545

    warning: C4786 identifier was truncated to '255' characters in the debug information

    I really REALLY hate VC++ 6.0!! But I'm stuck with it.

    From what I understand, there's no way to silence the C4786 warning, even if I add:
    Code:
    #pragma warning(disable: 4786)	// identifier was truncated to '255' characters in the debug information.
    before including the <utility> header...

    I have my project set to Treat Warnings As Errors; so once it hits this warning the build stops. I'd like to keep that setting if possible, so I was wondering if there's a way to temporarily turn off that setting (kind of like the #pragma warning(error:...) statements, except with the opposite effect)?

  2. #2
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    I think you're probably looking for the /IGNORE switch. I usually just add it as a parameter in my build settings (vs2005, but vc6 has the same command line options list in the project settings menu), but you could try using a #pragma comment.

    Code:
    #pragma comment(linker, "/IGNORE:4786")

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Or use shorter symbols??

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Bleech View Post
    I think you're probably looking for the /IGNORE switch. I usually just add it as a parameter in my build settings (vs2005, but vc6 has the same command line options list in the project settings menu), but you could try using a #pragma comment.

    Code:
    #pragma comment(linker, "/IGNORE:4786")
    I tried that, but it doesn't help.

    Quote Originally Posted by matsp View Post
    Or use shorter symbols??

    --
    Mats
    Unfortunately I didn't write the <utility> STL header, so that's not an option.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by cpjust View Post
    I tried that, but it doesn't help.


    Unfortunately I didn't write the <utility> STL header, so that's not an option.
    Yeah, I thought as much...

    We have some such things in our code at work too - don't cause any problem with the linker, but one of the auxilary tools we have seem to fall over on lines longer than 1500 chars, which is exceeded by a factor of 5 by some symbols in our code - so a little extra tool to remove such long lines makes it work, of sorts.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    Are you using PCH?
    I've never had a problem shutting them up. There is supposedly a real MS bug with disabling this warning (167355), but it doesn't seem to always be triggered.

    For non-PCH, just putting the pragma at the top of the file works for me. You can also try the "/wd n" compiler command line option.

    gg

  7. #7
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,248
    I think you should not try to block this warning. It is warning of a legitimate problem, which although it does not affect execution, might make debugging difficult.

    I believe in eliminating warnings by fixing them. If they can't be fixed, just let them be. Silencing the warning seems like the wrong thing. Just add a sentence to the build notes saying that this warning is expected.

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Apparently VC++ 6.0 doesn't recognize the /wd4786 switch.
    I'm not using PCH.

  9. #9
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by brewbuck View Post
    I think you should not try to block this warning. It is warning of a legitimate problem, which although it does not affect execution, might make debugging difficult.

    I believe in eliminating warnings by fixing them. If they can't be fixed, just let them be. Silencing the warning seems like the wrong thing. Just add a sentence to the build notes saying that this warning is expected.
    I like to fix warnings also, at least when the warning isn't caused by one of the standard header files from the ancient broken compiler.

    I'd like to let the warning appear and then just ignore it, but since I have "Treat Warnings As Errors" enabled, if I get even 1 warning, the build stops and I get no .exe...
    I like to use the "Treat Warnings As Errors" in addition to the highest warning level, because it forces people to fix warnings immediately instead of just ignoring it. Plus when you rebuild, you see all the warnings instead of just new ones in the files that were changed.

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Have you tried adding
    Code:
    /IGNORE:4786
    to your linker command-line, instead of using the pragma - I'm not sure how well those pragmas may work in older versions of the compiler.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #11
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Well I'll be... adding /IGNORE:4786 to the Linker tab seems to have fixed it (at least for now). But then again this problem only started appearing today out of nowhere, even though the code it's complaining about wasn't changed...

    BTW, why would you need to ignore that warning in the Linker tab instead of the Compiler tab? This is a Compiler warning after all...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. map warnings and microsoft visual C++ 6.0
    By DeepBlackMagic in forum C++ Programming
    Replies: 6
    Last Post: 07-17-2003, 03:52 PM
  2. Maps with VC++6 - funny looking warnings
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 07-09-2003, 07:34 PM
  3. OOP problem with "set"
    By beginner in forum C++ Programming
    Replies: 10
    Last Post: 01-17-2003, 10:43 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. I am confused with this code that somebody gave me
    By face_master in forum C++ Programming
    Replies: 14
    Last Post: 11-16-2001, 12:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21