- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, everyone,
For Qt builds using ICC on Windows with C++14 support enabled got error:
Feature 'c++14' was enabled, but the pre-condition 'features.c++11 && tests.c++14' failed
After some investigations found, that ICC failed test:
#if __cplusplus > 201103L #else # error "__cplusplus must be > 201103L (the value of C++11)" #endif
during configuration. While mingw-w64 passes it successfully.
The source of error is value of '__cplusplus' definition, which is 199711L for ICC, while 201402L for mingw-w64.
Using '-Qstd=c++14' or '-D__cplusplus=201402L' compiler keys didn't solve this issue.
Since ICC 2017 declare support of C++14, it's expected, that '__cplusplus' definition contain appropriate value. As mingw-w64 do. Is it possible to set '__cplusplus' value according to declared ICC features? So there won't be needed to hack various sources in order to skip such C++14 compliance tests.
Environment:
- Windows 10 x64,
- IPSXE 2017 Update 4,
- VS 2015 Update 3,
- Qt-5.9.
Alexander
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am currrently in the process of adding the new /Zc:___cplusplus switch to our Windows icl compiler, unfortunately it is past code freeze for 18.0 update 2 but it should be in 18.0 update 3 and the second beta of 19.0.
This is described here:
https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
Judy
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I can see, __cplusplus is inherited from MSVC++, so it might depend on which Visual Studio version is active. However, a brief google search indicates that Microsoft has declined to advance it beyond 201103, even in VS2017. Probably this indicates that Microsoft admits their support for newer standards is incomplete; by inheritance, the same would be true of ICL.
I didn't succeed in finding where it is set in VS2017 (which is organized entirely different from VS2015).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Tim, for a quick response.
But since ICC 2017 declare C++14 support, shouldn't it redefine '__cplusplus' according to implemented C++ Language features?
If not, how C++14 tests, like mentioned in 1st post, should be implemented in order to detect C++ Language support correctly? Yet again, mingw-w64 has no such troubles.
Alexander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No. In order to be compatible with the reference compiler on the system (on Windows this is MSVC++) we must set all macros to have the same value. This is important for example in ensuring we preprocess the system headers the same way as the reference compiler (since we don't have our own system headers).
The Intel compiler has implemented feature macros which might solve the problem.
See http://en.cppreference.com/w/cpp/experimental/feature_test
for examples such as __cpp_constexpr, etc.
Example:
#if __cpp_constexpr
// constexpr keyword implemented
#endif
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MSVC 2017 15.7 introduced '-Zc:__cplusplus' flag (see announce), which allows to set a proper value of '__cplusplus' definition for C++14, C++17 and later language support.
Can this flag be introduced in Windows ICC too?
Best,
Alexander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ICL couldn't support this until a release following a stable MSVC++ release (not preview). You have always had the option to override and set a new value of __cplusplus e.g. -U__cplusplus -D__cplusplus=201402L
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MSVC Developers announced, that MSVC 2017 version 15.7 Preview 3 available for download and shares link to related blog: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
So introduction of -Zc:__cplusplus switch in the next MSVC release is imminent.
Best,
Alexander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am currrently in the process of adding the new /Zc:___cplusplus switch to our Windows icl compiler, unfortunately it is past code freeze for 18.0 update 2 but it should be in 18.0 update 3 and the second beta of 19.0.
This is described here:
https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
Judy

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page