Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got C4996 warning when building an application with v140 toolset #2092

Closed
wwriter opened this issue Jan 12, 2021 · 1 comment
Closed

Got C4996 warning when building an application with v140 toolset #2092

wwriter opened this issue Jan 12, 2021 · 1 comment

Comments

@wwriter
Copy link

wwriter commented Jan 12, 2021

Hi, first of all thank you for providing and maintaining this great library.
I encountered this warning/error(depending on SDL check flag) while I've been testing my project with v140 toolset.
When I write codes somewhat like below,

#include <fmt/format.h>
#include <fmt/core.h>

int main()
{
  fmt::format(L"{}_{:04d}-{:02d}-{:02d}{}", L"filename", 2020, 1, 12, L".txt"};
  return 0;
}

I got this compile error, which says

C4996: 'std::uninitialized_copy_n::_Unchecked_iterators::_Deprecate': Call to 'std::uninitialized_copy_n' with parameters that may be unsafe 
- this call relies on the caller to check that the passed values are correct. 
To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

It seems to happen only when I set the project toolset to v140, and use wide characters.
( It works perfect if I use visual studio 2017(v141 toolset) or v140 toolset with narrow characters. )

I read through the issues somewhat similar to mine, but unfortunately I couldn't get any solutions from them.
Is there something that I can do to successfully build my project in that environment?
( Defining _SCL_SECURE_NO_WARNINGS is not a good option for me )

@vitaut vitaut changed the title Got a compile time error (C4996) when building an application with v140 toolset Got C4996 warning when building an application with v140 toolset Jan 15, 2021
@vitaut
Copy link
Contributor

vitaut commented Jan 18, 2021

Same as #1947.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants