[Interest] Building Qt 5.9 with Visual Studio 2017 and C++14 support

Thiago Macieira thiago.macieira at intel.com
Mon Feb 19 00:12:27 CET 2018


On Sunday, 18 February 2018 14:55:20 PST Bob Hood wrote:
> Is there some special trick to getting Qt 5.9.4 to build with Visual Studio
> 2017 using C++14?

No. C++14 is always enabled with MSVC 2017. That also means you can't turn it 
off, which in turn means the -c++std option is irrelevant.

> So I can't use that option with Visual Studio 2017.  Visual Studio 2017 is
> supposed to provide C++14, but my buildis stating:
> 
>     ...
>     Checking for C++14 support... no
>     ...
>     Using C++ standard ..................... C++11
>     ...

The Qt ABI is the same whether Qt itself was compiled with C++11, 14 or 17, in 
all supported compilers. So the -c++std option is really irrelevant and you 
should never set it. Please ignore it and ignore the output that configure 
prints.

In any case, what it prints is just a side-effect of there being no way to 
tell the compiler which version to target. So configure detects it does 
support C++11 features we need and can't turn anything else further on, so 
reports C++11.

Note that the /std:c++latest option to the compiler should not be used. It's 
imperfectly implemented and is known to break Windows SDK headers, so Qt is 
not tested with the option. If you choose to use the option and something 
breaks, you get to keep both pieces. However, if you fix the breakage, patches 
will be appreciated.

Finally, please note that due to disagreements with Microsoft's compiler team 
on some  C++14 feature detection mechanisms, Qt headers will conclude the 
feature is absent. Please redirect your complaints about __has_include and the 
detection macros to Microsoft. They are aware of the subject and it seems they 
will implement the rules as all the other compilers do in the future, but I 
don't have a timeline for you. If you really want those features, put pressure 
on them or use another compiler. Also, you can still use them in your code.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Interest mailing list