I am getting a whole bunch of these:

warning C4996: 'vsprintf' was declared deprecated
see declaration of 'vsprintf'
Message: 'This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE.

I put this at the top of my code:

#define _CRT_SECURE_NO_DEPRECATE

but nothing changed, I still get the warnings.

Any reason why this wouldn't fix it?

Thanks,

Dave

Recommended Answers

All 4 Replies

>Any reason why this wouldn't fix it?
I add warning 4996 to my "I don't give a crap" list in the project settings[1]. You can also disable it directly in the code using a pragma:

#pragma warning(disable:4996)

[1] Assuming you're using Visual Studio, of course. ;)

hmm sounds like a good fix - but why didn't (#define _CRT_SECURE_NO_DEPRECATE) work? I shouldn't have to do that #pragma for every error like this that I'm getting should I?

>but why didn't (#define _CRT_SECURE_NO_DEPRECATE) work?
If I knew that I would have told you.

>I shouldn't have to do that #pragma for every error like this that I'm getting should I?
When you do this it turns off the warning completely, you'll never get it again. That's why you should be completely sure that the warning is nothing more than an eyesore and its presence hurts you by hiding legitimate information. Warning 4996 is an extremely rare exception. I've only disabled one warning in my entire career, and this is that warning.

Are you putting the #define before all the #includes ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.