Muokkaa

Jaa


Compiler Warning (level 1) C5050

Possible incompatible environment while importing module 'module_name': issue

Remarks

The compiler raises C5050 whenever the command-line options for modules aren't consistent between the module creation and module consumption sides.

This warning is new in Visual Studio 2017 version 15.9. It's only generated when creating or consuming modules, specified by the /experimental:module compiler option.

Example

In the following example, there are two issues:

  • On the consumption side (main.cpp), the option /EHsc isn't specified.

  • The C++ version is /std:c++17 on the creation side, and /std:c++14 on the consumption side.

cl /EHsc /std:c++17 m.ixx /experimental:module
cl /experimental:module /module:reference m.ifc main.cpp /std:c++14

The compiler raises C5050 for both of these cases:

warning C5050: Possible incompatible environment while
importing module 'm': mismatched C++ versions.
Current "201402" module version "201703".

To resolve the issue, use the same compiler command line options for both the module and the consuming code.