Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Intel Compiler 19.0 Initial Release C++17 support with Visual Studio 2017

Marques__Thiago
712 Views

I'm currently evaluating the possibility to move from C++11 to C++17. I currently use VS 2017 and Intel Compiler 19.0.0 (Initial Release), and I got two questions:

 

⚫ Q1: Does IC 19.0.0 supports C++17 with VS 15.7 or older versions?

I checked the Visual Studio 2017 support article [1] and it says the following regarding VS 2017, IC 19.0.0 and C++17:

Microsoft Visual Studio 2017 version | Supported Intel Compiler Version
-------------------------------------|----------------------------------------------
15.8                                 | 19.0 but without the additional C++17 support
15.7                                 | 19.0
15.6, 15.5, 15.4                     | 19.0 Initial Release

[1]: https://software.intel.com/en-us/articles/intel-compilers-integration-support-for-microsoft-visual-studio-2017

There is no note on C++17 support with VS 15.4 to 15.7, but there is an explicit note on the lack of support with 15.8, This gives me the impression that IC 19.0 would support C++17 on these older VS versions. I tried searching the FAQs, Release Notes and documentation as well as this forum, but I could not find any piece of information to confirm if C++17 is supported or not with those older VS 2017 minor versions.

Does anyone here knows if IC 19.0.0 supports compiling code in C++17 mode when used with VS 2017 minor versions 15.7 or older?

 

⚫ Q2: How can I tell compilervars.bat which VS 2017 toolset (minor version) it should use?

My VS 2017 install (15.9.19) has multiple VC toolsets (found in the VC\Tools\MSVC directory):

VC Toolset | `_MSC_VER` | VS 2017 version
-----------|------------|----------------
   14.13   |    1913    |      15.6
   14.14   |    1914    |      15.7
   14.16   |    1916    |      15.9

When calling compilervars.bat to set up the development environment, I couldn't find a way to tell it which VS 2017 toolset it should use. By compiling a simple program which outputs the _MSC_VER, it seems to be getting the latest one (VC 14.16, VS 15.9):

// version.cpp
#include <iostream>
int main() {
    std::cout << _MSC_VER << '\n';
}
> "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\bin\compilervars.bat" intel64 vs2017
> icl.exe version.cpp
> version.exe
1916

Assuming that ICC 19.0.0 would support C++17 mode with VS 2017 15.7 or older, I would need to find a way to make compilervars.bat use another toolset version (e.g.: VC 14.13, VS 15.6). 

Is there any way to tell compilervars.bat which VS 2017 toolset (minor version) it should use among the ones installed?

0 Kudos
5 Replies
Viet_H_Intel
Moderator
712 Views

For Q1: Yes and you can see the list of C++17 support in 19.0 at https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler.

I would recommend 19.1 for better support.

0 Kudos
Marques__Thiago
712 Views

Thank you for your quick reply  :-)

Viet Hoang (Intel) wrote:

For Q1: Yes and you can see the list of C++17 support in 19.0 at https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler.

This list seems to have only language-level C++17 features. Do you know if the Intel Compiler 19.0 also supports C++17 Standard Library features, like the new <filesystem>, <optional> and <variant> headers?

0 Kudos
Viet_H_Intel
Moderator
712 Views

Yes, but you will need to have at least GCC 7.1 on your system and at least 19.0 Update 1.

$ icpc -std=c++17 t.cpp -c -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.1.144 Build 20181018
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

$ cat t.cpp
#include <string>
#include <iostream>
#include <optional>

std::optional<std::string> create(bool str) {
    if (str)
        return "hello";
    return {};
}

 

0 Kudos
Marques__Thiago
712 Views

Viet Hoang (Intel) wrote:

Yes, but you will need to have at least GCC 7.1 on your system and at least 19.0 Update 1.

So IC 19.0.0 (Initial release) doesn't support C++17 headers in Windows with VS 2017?

0 Kudos
Viet_H_Intel
Moderator
712 Views

I think so.

0 Kudos
Reply