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:

Amastaneh said...

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

Amastaneh said...

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

huyanh said...

It works. Thank you very much

Abdul Basit said...

Thanks a lot. it really helped me.

Anonymous said...

disable WX

Anonymous said...

thanks, very good =)

Anonymous said...

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.

Anonymous said...

Perfect just what I was looking for!

Anonymous said...

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

Anonymous said...

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

Anonymous said...

isabella en phineas seks

Anonymous said...

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

Anonymous said...

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

Anonymous said...

Your place is valueble for me. Thanks!

Anonymous said...


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

Anonymous said...


This can be very useful for me.

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...


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

Anonymous said...

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