2

I am upgrading our codebase to C++17 via the v142 toolset offered by Visual Studio 2019. When running my program compiled with this toolset, the OS reports:

(program name).exe - System Error

The program can't start because api-ms-win-core-processenvironment-l1-2-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

OK

This is unexpected. The prior build used v140. Both builds use the 10.0.15063.0 SDK. WINVER is set to 0x0601 on the command line, as is _WIN32_WINNT, so I expect nothing untoward to happen. Running depends.exe to investigate dependencies yielded the following:


Dependency Walker output


The pane on the right shows the result of building with v140, and the pane on the left shows the result of building with v142. As you can see, they're both bound to the same runtime, and the missing DLLs bind to nothing exotic: the first item is looking for GetCommandLineW and GetCurrentDirectoryW.

hatcat
  • 1,876
  • 1
  • 18
  • 37
  • 3
    Did you install the proper redistributables? Document your steps so far. – Lightness Races in Orbit Dec 10 '19 at 14:01
  • Maybe this post will help: https://stackoverflow.com/questions/58336827/how-to-run-a-c-program-i-wrote-on-another-computer/58336900#58336900 – Adrian Mole Dec 10 '19 at 14:12
  • You'll see in the image that VCRUNTIME140D.DLL is installed: they are shared between VS2015, VS2017 and VS2019. Documenting my steps so far: I have installed VS2019, modified the build to use the v142 toolset and fixed a selection of compilation errors brought about by improved conformance. I think I'll be taking a look at the verbose linker output next... – hatcat Dec 10 '19 at 15:13

1 Answers1

2

You appear to be linking against mincore.lib. This library is designed to reduce loaded DLLs on windows 8 and up and is not supported on Windows 7:

Compatibility with Windows 7, Windows Server 2008 R2 and older operating systems: Binaries that link to MinCore.lib or MinCore_Downlevel.lib are not designed to work on Windows 7, Windows Server 2008 R2 or earlier. Binaries that need to run on earlier versions of Windows or Windows Server must not use either MinCore.lib or MinCore_Downlevel.lib.

Mgetz
  • 5,108
  • 2
  • 33
  • 51