MSVS Community Edition, v17.12.5 (latest), Win10 (latest), 64-bit
I've raised an issue with MS, but after their acknowledging that they've replicated the problem (with a copy of my entire solution), they've ghosted me, saying that they'll focus on problems affecting the wider community. They've not responded to further inquiries and the issue's status is now "Under Consideration". Meanwhile, I'm stuck with a solution that won't build.
Links to the relevant webpages at the bottom.
Short version:
I’m getting a C1011 error in a C++ console project that imports the STL (
import std;
). I followed the MS C1011 help page but the error persists. I don’t know how MSVS wants me to locate the STL module interface.
Long version:
In fact, I have two different C++ solutions, each for console and containing a single project accessing the SLT using
import std;
. In the first I’m using a mixture of
#include <xxx.hpp>
and
import xxx;
across 9 of my own .cpp files (i.e. 6 have .hpp; 3 have .ixx interfaces). The second solution is self-contained – there are no #includes only
import std;
.
I was successfully building both with /experimental:module and /std:c++latest[/quote] iaw the guidance offered in the MS article "Overview of modules in C++". I have Configuration Properties > C/C++ > Language Build ISO C++23 Standard Library Modules enabled (so I shouldn’t have to build the STL module myself, iaw Tutorial: Import C++ STL Using Modules, right?).
Having not touched either solution in over a month, I rebuilt them after the latest MSVS updates (17.12.4 and 17.12.5) which promptly generated LNK1318 errors. Removing the /experimental:module flag (iaw MS problem report "fatal error LNK1319") resolved the problem on the second solution.
Implementing that fix on the first solution instead generates a fatal C1011 error. I confirmed the Build ISO C++23 STL Module and /stdc++latest flags are enabled and ensured that I have installed the Modules for v143 build tools component via the VS Installer (from the C1011 help page). That matches the solution's Configuration Properties > General > Platform Toolset (v143).
Paradoxically, the Build output shows:
Target ComputeStdModulesCompileInputs:
1> Reading library manifest file ‘D:\Programs\Visual Studio 2022\VC\Tools\MSVC\14.42.34433\modules\modules.json’ which provides data for library ‘microsoft/STL’.
1> Adding module source ‘D:\Programs\Visual Studio 2022\VC\Tools\MSVC\14.42.34433\modules\std.ixx’ from library ‘microsoft/STL’ to be built with this project.
1> Adding module source ‘D:\Programs\Visual Studio 2022\VC\Tools\MSVC\14.42.34433\modules\std.compat.ixx’ from library ‘microsoft/STL’ to be built with this project. |
and the files (built 19 Jan 2025) exist on that path.
The error location suggests that this has something to do with my use of
import std.filesystem;
immediately after an
import std;
but if I remove the former I resolve the first error and then get 5 more C1011 errors in two .hpp files all on
import std.filesystem;
Has std.filesystem been incorporated into std?
What am I missing? Can anyone help?
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1011?view=msvc-170&f1url=%3FappId%3DDev17IDEF1%26l%3DEN-US%26k%3Dk(C1011)%26rd%3Dtrue
https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp?view=msvc-170
https://learn.microsoft.com/en-us/cpp/cpp/tutorial-import-stl-named-module?view=msvc-170&source=docs
https://developercommunity.visualstudio.com/t/fatal-error-LNK1318:-Unexpected-PDB-erro/10791875