I ported my project over from Visual Studio 2012 to 2013 and sqlite.c will not compile in it. I'm receiving this compile-time error:
error C4996: 'GetVersionExA': was declared deprecated
error C4996: 'GetVersionExW' was declared deprecated
I got the latest version of sqlite to ensure it hasn't been accounted for, but it has not. I'm not sure what to do about this error. I have made no modifications to the source; I'm simply creating a project and including sqlite.h and sqlite.c. Thanks.
This is because SDL check, try to disable SDL checks:
Project Properties > Configuration Properties > C/C++ > General > SDL checks [set to No]
Actually C4996 is a warning, but sometimes it behaves as an error.
Anyways, you can just disable it, by using the /wd4996 compiler option, or using the pragma:
#pragma warning(disable: 4996)
Better than disabling warnings, you can just disable the relevant code as it is intended to be disabled by adding to the file's preprocessor defines.
Right-click on sqlite3.c, click Properties, Configuration Properties->C/C++->Preprocessor. Make sure you have "all configurations" selected for the configuration and platform dropdowns (unless you only have one platform, then just select the one that's available) and edit the Preprocessor Definitions to be
SQLITE_WIN32_GETVERSIONEX=0;%(PreprocessorDefinitions)
This will skip the NTDDI_VERSION
check since that symbol isn't defined or is defined incorrectly when your compiler hits sqlite3.c.
There's this comment in there, too, which may be interesting:
/*
** NOTE: All sub-platforms where the GetVersionEx[AW] functions are
** deprecated are always assumed to be based on the NT kernel.
*/
The net effect of setting that #define
is that your OS is always assumed to be based on Win NT, which it is since you're Win 8.1 or Win 10 (or greater). ;)
So basically by disabling that warning you're just making your code slower because it needs to do work to figure out if it's on WinNT or not.
I had a similar problem trying to use WTL in a VS 2013 C++ app. Try changing the Platform Toolset
in the General
page of your project settings to Visual Studio 2013 - Windows XP (v120_xp)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With