Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 C++ Standard Library Modules

VS2017 comes with the possibility to install Standard Library Modules.

In fact in Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\ifc\ there are ifc module definition files and std.lib for x86/x64 and Debug/Release. How do we use them? How do you link against them? And what exactly is available in these standard modules?

like image 944
HiroshimaCC Avatar asked Mar 08 '17 13:03

HiroshimaCC


People also ask

What is the C runtime library?

The C runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C standard library. The Visual C++ libraries that implement the CRT support native code development, and both mixed native and managed code. All versions of the CRT support multi-threaded development.

What are CPP modules?

A module is a set of source code files that are compiled independently of the translation units that import them. Modules eliminate or reduce many of the problems associated with the use of header files. They often reduce compilation times.

What is UCRT and Msvcrt?

MSVCRT vs UCRT These are two variants of the C standard library on Microsoft Windows. MSVCRT (Microsoft Visual C++ Runtime) is available by default on all Microsoft Windows versions, but due to backwards compatibility issues is stuck in the past, not C99 compatible and is missing some features.

How do I download C++ library Visual Studio?

The Redistributable is available in the my.visualstudio.com Downloads section as Visual C++ Redistributable for Visual Studio 2019 - Version 16.7. Use the Search box to find this version. To download the files, select the platform and language you need, and then choose the Download button.


1 Answers

I got the following code sample working:

import std.core;

int main()
{
    std::cout << "Hello world\n";
    return 0;
}

by passing these extra parameters to the compiler:

/experimental:module /module:search "path-to-standard-library-ifc-modules"

and providing the full path to std.lib in the ifc folder to the linker

properties->linker->additional dependencies

EDIT:

Adding some additional info since this was the only Google result i found regarding this question:

On my computer these files are located in:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\ifc

They are installed when the "standard library modules" component is selected during installation of visual studio 2017.

like image 143
Jo Øivind Gjernes Avatar answered Oct 21 '22 22:10

Jo Øivind Gjernes