Safe to ignore this warnings ?

I was playing around with modules in VS 2017 CE and got this warnings.
Are they safe to ignore ?

Error	C4996	'std::uncaught_exception': warning STL4006: 
std::uncaught_exception() is deprecated in C++17. 
It is superseded by std::uncaught_exceptions(), plural. 
You can define _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING or 
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge 
that you have received this warning.	
ModuleDemo	d:\agent\_work\2\s\binaries\x86ret\inc\ostream	137

Warning	C5050	Possible incompatible environment while importing 
module 'std.core': _GUARDOVERFLOW_CRT_ALLOCATORS=1 is 
defined in current command line and not in module command line	
ModuleDemo	moduledemo.cpp	24

Warning	C5050	Possible incompatible environment while 
importing module 'std.core': _M_FP_PRECISE is defined in current 
command line and not in module command line	ModuleDemo 
moduledemo.cpp	24



1
2
3
4
5
6
7
8
9
10
11
#pragma warning(disable : 4996) // disabled above warnings
#pragma warning(disabled: 5050)

import std.core;

int main()
{
	std::vector<std::string> words = {"Hello ", "world"};
	std::copy(words.begin(), words.end(), 
			std::ostream_iterator<std::string>(std::cout, " "));
}
Last edited on
Why the import?
They are supposed to replace the include files.
@kbw,
Although not specified by the C++20 standard, Microsoft enables its implementation of the C++ Standard Library to be imported as modules. By importing the C++ Standard Library as modules rather than #including it through header files, you can potentially speed up compilation times depending on the size of your project.

https://docs.microsoft.com/en-us/cpp/cpp/modules-cpp?view=vs-2019
@Learner2, did you set the project's options to use modules?

Properties -> C/C++ -> C++ Language Standard -> std:c++latest

Properties -> C/C++ -> C++ Modules (experimental) -> Yes

VS 2017 doesn't like C++20 modules no matter what you do. Try the same project and settings in VS 2019 and no problems. You might consider upgrading to VS 2019.

I have both 2017 and 2019 installed and 2019 is less cranky and clunky, vs. 2017 IMO.

YMMV.
@Furry Guy,

yes I set the project options. The code actually runs fine when I disable the warnings on line 1+2
I just wondered what they mean and if I can safely ignore them.

I tried VS 2019 but it was far too slow on my old PC.

BTW. The build is much faster than with the #include statements.
Topic archived. No new replies allowed.