inih icon indicating copy to clipboard operation
inih copied to clipboard

C4996 Warnings Are Not Suppressed

Open WongZeHao opened this issue 5 years ago • 2 comments

Hi, there are C4996 warnings when I try to compile my code with #include "INIReader.h" in multiple files. I didn't add _CRT_SECURE_NO_WARNINGS for my project but it should be fine as INIReader.h attempts to suppress this particular warning for its codes using codes below.

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif

Is there anything missing in code or I need to define _CRT_SECURE_NO_WARNINGS explicitly?


Information about the IDE I am using:

  • IDE: Visual Studio 2017
  • Windows SDK Version: 10.0.17134.0
  • Platform Toolset: Visual Studio 2017 (v141)

WongZeHao avatar Mar 07 '20 03:03 WongZeHao

Sorry, I have no idea. I'm not using visual studio. Do you also run into this problem with the original version of inih (https://github.com/benhoyt/inih)?

Just googling this for a second, you may need to amend the line above (see https://stackoverflow.com/a/46092214/2208605) so that it says

#define _CRT_SECURE_NO_WARNINGS 1

jtilly avatar Mar 09 '20 18:03 jtilly

Consider using this #pragma warning(suppress : 4996) https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?f1url=%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(C4996)%26rd%3Dtrue&view=vs-2019

ArturSalamatin avatar Oct 09 '20 12:10 ArturSalamatin