Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error under MinGW (Windows) #171

Closed
mjh65 opened this issue Nov 12, 2023 · 2 comments
Closed

Compile error under MinGW (Windows) #171

mjh65 opened this issue Nov 12, 2023 · 2 comments

Comments

@mjh65
Copy link
Collaborator

mjh65 commented Nov 12, 2023

Commit f9128d1 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<value_type> __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<value_type> __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<allocator_type>& __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<allocator_type>& __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<allocator_type>& __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<allocator_type>& __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
Copy link
Collaborator Author

mjh65 commented Nov 12, 2023

I think this is because fs::u8path() on Windows returns a basic_string<wchar_t> (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
Copy link
Collaborator Author

mjh65 commented Nov 12, 2023

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

I think that should be portable too?

@fpw fpw closed this as completed in 7561d57 Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant