fpw / avitab

X-Plane plugin that displays a tablet to aid VR usage
GNU Affero General Public License v3.0
299 stars 58 forks source link

Compile error under MinGW (Windows) #171

Closed mjh65 closed 10 months ago

mjh65 commented 10 months ago

Commit f9128d1015dde1c37fd5908001c63e3de70b94a9 introduces a compilation error when building with MinGW for Windows.

W:/avitab/src/avitab/apps/MapApp.cpp: In member function 'void avitab::MapApp::selectOnlineMaps()': W:/avitab/src/avitab/apps/MapApp.cpp:312:42: error: no matching function for call to 'std::vector<std::cxx11::basic_string >::vector()' 312 | fs::u8path(mapConfigPath)}); | ^ In file included from C:/msys64/mingw64/include/c++/12.1.0/vector:64, from W:/avitab/src/avitab/apps/MapApp.h:23, from W:/avitab/src/avitab/apps/MapApp.cpp:21: C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:551:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; size_type = long long unsigned int; allocator_type = std::allocator<std::cxx11::basic_string >]' 551 | vector(size_type n, const allocator_type& a = allocator_type()) | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:551:51: note: no known conversion for argument 2 from 'std::filesystem::cxx11::path' to 'const std::vector<std::cxx11::basic_string >::allocator_type&' {aka 'const std::allocator<std::cxx11::basic_string >&'} 551 | vector(size_type __n, const allocator_type& a = allocator_type()) | ~~~~^~~~~~~~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:564:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; size_type = long long unsigned int; value_type = std::cxx11::basic_string; allocator_type = std::allocator<std::cxx11::basic_string >]' 564 | vector(size_type n, const value_type& __value, | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:564:47: note: no known conversion for argument 2 from 'std::filesystem::cxx11::path' to 'const std::vector<std::cxx11::basic_string >::value_type&' {aka 'const std::cxx11::basic_string&'} 564 | vector(size_type n, const value_type& __value, | ~~~~^~~~~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:702:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with = _InputIterator; _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >]' 702 | vector(_InputIterator first, _InputIterator last, | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:702:9: note: template argument deduction/substitution failed: W:/avitab/src/avitab/apps/MapApp.cpp:312:42: note: deduced conflicting types for parameter '_InputIterator' ('const char*' and 'std::filesystem::cxx11::path') 312 | fs::u8path(mapConfigPath)}); | ^ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:673:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; allocator_type = std::allocator<std::cxx11::basic_string >]' 673 | vector(initializer_list l, | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:673:43: note: no known conversion for argument 1 from 'const char [38]' to 'std::initializer_list<std::cxx11::basic_string >' 673 | vector(initializer_list l, | ~~~~~~~^ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:654:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::type_identity_t<_Alloc>&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; std::__type_identity_t<_Alloc> = std::allocator<std::cxx11::basic_string >]' 654 | vector(vector&& rv, const type_identity_t& m) | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:654:23: note: no known conversion for argument 1 from 'const char [38]' to 'std::vector<std::__cxx11::basic_string >&&' 654 | vector(vector&& rv, const type_identity_t& m) | ~~~^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; allocator_type = std::allocator<std::cxx11::basic_string >; std::false_type = std::integral_constant<bool, false>]' 635 | vector(vector&& rv, const allocator_type& m, false_type) | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:630:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; allocator_type = std::allocator<std::cxx11::basic_string >; std::true_type = std::integral_constant<bool, true>]' 630 | vector(vector&& rv, const allocator_type& __m, true_type) noexcept | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:630:7: note: candidate expects 3 arguments, 2 provided C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:619:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::type_identity_t<_Alloc>&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; std::type_identity_t<_Alloc> = std::allocator<std::__cxx11::basic_string >]' 619 | vector(const vector& x, const type_identity_t& __a) | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:619:28: note: no known conversion for argument 1 from 'const char [38]' to 'const std::vector<std::cxx11::basic_string >&' 619 | vector(const vector& x, const type_identity_t& a) | ~~~~^ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:615:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >]' 615 | vector(vector&&) noexcept = default; | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:615:7: note: candidate expects 1 argument, 2 provided C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:596:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >]' 596 | vector(const vector& x) | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:596:7: note: candidate expects 1 argument, 2 provided C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:537:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::cxx11::basic_string >; allocator_type = std::allocator<std::cxx11::basic_string >]' 537 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:537:7: note: candidate expects 1 argument, 2 provided C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:526:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::cxx11::basic_string; _Alloc = std::allocator<std::__cxx11::basic_string >]' 526 | vector() = default; | ^~ C:/msys64/mingw64/include/c++/12.1.0/bits/stl_vector.h:526:7: note: candidate expects 0 arguments, 2 provided make[2]: [CMakeFiles/avitab_common.dir/build.make:1322: CMakeFiles/avitab_common.dir/src/avitab/apps/MapApp.cpp.obj] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/w/avitab/build' make[1]: [CMakeFiles/Makefile2:128: CMakeFiles/avitab_common.dir/all] Error 2 make[1]: Leaving directory '/w/avitab/build' make: [Makefile:136: all] Error 2 make: Leaving directory '/w/avitab/build'

mjh65 commented 10 months ago

I think this is because fs::u8path() on Windows returns a basic_string (and there is no implicit conversion to std::string available.) Not yet certain whether an easy (portable) fix is available, or if some conditional code will be required for WIndows.

mjh65 commented 10 months ago

OK, fix looks fairly easy: fs::u8path(mapConfigPath).string()});

I think that should be portable too?