leapmotion / autowiring

A C++ Inversion of Control Framework
http://autowiring.io/
Apache License 2.0
148 stars 17 forks source link

Failed to build autowiring with /std:c++17 + msvc + windows #1051

Closed PhoebeHui closed 6 years ago

PhoebeHui commented 6 years ago

Build Autowiring with /std:c++17 with Visual studio 2017(version 15.5.7) on windows failed with following failures, could you help have a look?

D:\Autowiring\src\src.\autowiring/C++11/filesystem.h(20): error C2874: using-declaration causes a multiple declaration of 'std::experimental::filesystem::v1::path' [D:\Autowiring\build_x86\src\autowiring\test\AutowiringTest.vcxproj]
D:\Autowiring\src\src.\autowiring/C++11/filesystem.h(26): error C2874: using-declaration causes a multiple declaration of 'std::experimental::filesystem::v1::filesystem_error' [D:\Autowiring\build_x86\src\autowiring\test\AutowiringTest.vcxproj]

jdonald commented 6 years ago

Hi @PhoebeHui,

1055 adds various fixes for /std:c++17. However, we were never able to reproduce your std::experimental issue, having tested VS2017 versions 15.6.1, 15.5.7, and earlier. Is it possible you had other local changes that inadvertently caused multiple using statements?

Please let us know if the problem persists.

CaseyCarter commented 6 years ago

The "15.5.7" in the report is misleading: this is actually a problem in the next (as-yet-unreleased) preview of 15.7. C++11/filesystem.h declares several entities in std::filesystem which clash with entities that the Microsoft standard library defines in std::filesystem in that next release. We're reporting the problem before we break you to give you a head start.

jdonald commented 6 years ago

@CaseyCarter that makes sense. Thanks for the heads-up.

I'm looking to #ifdef out this code for future Visual Studio releases. However, _MSC_VER seems to be still set to 1913 (same as version 15.6) in 15.7.0 Preview 1.0. Is that going to be bumped to 1914 or is there some other proper way to detect whether the built-in std::filesystem is available?

CaseyCarter commented 6 years ago

I "strongly suspect" that 15.7 Preview 2 will define _MSC_VER to 1914. (I can never tell which prerelease details are ok to disclose. I may get fired, but helping to fix your bugs is just that important to us here at Microsoft.)