Solution for _CRT_SECURE_NO_WARNINGS error

SMJ
loading... read

⚠️ This post was last updated on July 10, 2019 and the content may be OUTDATED!

If you encounter any issues, please feel free to reachout to me!

platform: VS2019
os: win10

Problem:
An error about _CRT_SECURE_NO_WARNINGS when I use the std::localtime() function for getting the current systime.

Solution:

  1. Use an alternative feature function in C++.
  2. add this line at the first line.
#define _CRT_SECURE_NO_WARNINGS
  1. add _CRT_SECURE_NO_WARNINGS on the pre-processor(project>properties>C/C++>preprocessor)

Sooner or later, everything ends.