Pages

November 02, 2007

Warning treated as error

Problem: warning treated as error - no 'object' file generated

error C2220: warning treated as error - no 'object' file generated
warning C4996: 'wcstombs' was declared deprecated
warning C4996: 'sprintf' was declared deprecated
warning C4996: 'mbstowcs' was declared deprecated
warning C4996: 'wcstombs' was declared deprecated
warning C4996: 'fopen' was declared deprecated
warning C4996: 'strncpy' was declared deprecated
warning C4996: 'strcat' was declared deprecated


Solution:
Paste below line on top of your cpp file [link]
#pragma warning ( disable : 4996 )

Story:-D
Today's holiday and i'm alone in company.
A quiet and cold night and my friends enjoy of party and i'm fighting with an obsolete COM base code for an important project.

Other Solution From Comments/Without Judgments
Last Update @2013
#pragma warning( disable : 4786 )
Set Project Settings > Configuration Properties > C/C++ > General > Treat Warnings As Errors as No
disable WX
- using vsprintf_s

25 comments:

  1. Disable warning about debug info truncated.
    #pragma warning( disable : 4786 )

    ReplyDelete
  2. Set Project Settings > Configuration Properties > C/C++ > General > Treat Warnings As Errors as No

    ReplyDelete
  3. It works. Thank you very much

    ReplyDelete
  4. Thanks a lot. it really helped me.

    ReplyDelete
  5. thanks, very good =)

    ReplyDelete
  6. My partner and I certainly taking advantage of just about every single little piece of it and, I have this information saved to check out out brand-new things you will post to your blog.

    ReplyDelete
  7. Perfect just what I was looking for!

    ReplyDelete
  8. Maybe you can write next articles referring to this article. I want to read more things about it!

    ReplyDelete
  9. I am coming back to your site for additional before long.

    ReplyDelete
  10. isabella en phineas seks

    ReplyDelete
  11. решил помочь и разослал пост в соц. закладки. надеюсь поднимется популярность.

    ReplyDelete
  12. Актуальный блог, свежая инфа, почитываю

    ReplyDelete
  13. Your place is valueble for me. Thanks!

    ReplyDelete

  14. You were capable to strike the nail on the head plus spelled out the entire thing with out complication.

    ReplyDelete

  15. This can be very useful for me.

    ReplyDelete

  16. I am just getting started on the Internet. I am retired now.

    ReplyDelete

  17. I really enjoyed every little bit of it and I have you bookmarked to check out the new stuff on you site.

    ReplyDelete

  18. Music started playing anytime I opened up this web page, so annoying!

    ReplyDelete

  19. I cant believe youre no more in style since you positively have the gift.

    ReplyDelete

  20. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your site?

    ReplyDelete

  21. I am not sure where you are getting your information, but great topic.

    ReplyDelete

  22. You were capable to strike the nail on the head plus spelled out the entire thing with out complication.

    ReplyDelete

  23. Saved as a favorite, I really like your web site!

    ReplyDelete
  24. I wouldn't recommend turning warnings as errors off. This is bad practice and can lead to far worse problems in the future. I would suggest finding a workaround like using vsprintf_s

    ReplyDelete