Closed mimi89999 closed 1 year ago
I didn't see this exact error, but I noticed and fixed some other errors when compiling without PCH using MSVC.
Thanks for fixing that!
There is still the nullptr to bool conversion warning that is treated as an error due to -Werror
[1/319] Building CXX object CMakeFiles/_winrt.dir/pywinrt/winsdk/src/_winrt_array.cpp.obj
FAILED: CMakeFiles/_winrt.dir/pywinrt/winsdk/src/_winrt_array.cpp.obj
C:\msys64\clang64\bin\c++.exe -D_winrt_EXPORTS -IC:/Users/Michel/git/python-winsdk/cppwinrt -IC:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src -isystem C:/msys64/clang64/include/python3.10 -O3 -DNDEBUG -std=gnu++20 -Werror -MD -MT CMakeFiles/_winrt.dir/pywinrt/winsdk/src/_winrt_array.cpp.obj -MF CMakeFiles\_winrt.dir\pywinrt\winsdk\src\_winrt_array.cpp.obj.d -o CMakeFiles/_winrt.dir/pywinrt/winsdk/src/_winrt_array.cpp.obj -c C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/_winrt_array.cpp
In file included from C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/_winrt_array.cpp:3:
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:32:22: error: implicit conversion of nullptr constant to 'bool' [-Werror,-Wnull-conversion]
return T{nullptr};
~^~~~~~~
false
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:2112:70: note: in instantiation of member function 'py::empty_instance<bool>::get' requested here
array = winrt::com_array<T>(size, empty_instance<T>::get());
^
C:/msys64/clang64/include/c++/v1/__memory/unique_ptr.h:714:32: note: in instantiation of member function 'py::ComArray<bool>::Alloc' requested here
return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/_winrt_array.cpp:115:36: note: in instantiation of function template specialization 'std::make_unique<py::ComArray<bool>>' requested here
self->array = std::make_unique<py::ComArray<bool>>();
^
1 error generated.
[5/319] Building CXX object CMakeFiles/_winrt.dir/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp.obj
FAILED: CMakeFiles/_winrt.dir/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp.obj
C:\msys64\clang64\bin\c++.exe -D_winrt_EXPORTS -IC:/Users/Michel/git/python-winsdk/cppwinrt -IC:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src -isystem C:/msys64/clang64/include/python3.10 -O3 -DNDEBUG -std=gnu++20 -Werror -MD -MT CMakeFiles/_winrt.dir/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp.obj -MF CMakeFiles\_winrt.dir\pywinrt\winsdk\src\py.Windows.AI.MachineLearning.cpp.obj.d -o CMakeFiles/_winrt.dir/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp.obj -c C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp
In file included from C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp:3:
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:32:22: error: implicit conversion of nullptr constant to 'bool' [-Werror,-Wnull-conversion]
return T{nullptr};
~^~~~~~~
false
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/py.Windows.Foundation.Collections.h:2102:70: note: in instantiation of member function 'py::empty_instance<bool>::get' requested here
winrt::com_array<T> items(length, empty_instance<T>::get());
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/py.Windows.Foundation.Collections.h:1872:9: note: in instantiation of member function 'py::impl::Windows::Foundation::Collections::IVectorView<bool>::seq_subscript' requested here
IVectorView(winrt::Windows::Foundation::Collections::IVectorView<T> o) : _obj(o) {}
^
C:/msys64/clang64/include/c++/v1/__memory/unique_ptr.h:714:32: note: in instantiation of member function 'py::impl::Windows::Foundation::Collections::IVectorView<bool>::IVectorView' requested here
return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:605:33: note: in instantiation of function template specialization 'std::make_unique<py::impl::Windows::Foundation::Collections::IVectorView<bool>, winrt::Windows::Foundation::Collections::IVectorView<bool> &>' requested here
py_instance->obj = std::make_unique<typename ptype::concrete>(instance);
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:647:24: note: in instantiation of function template specialization 'py::wrap_pinterface<winrt::Windows::Foundation::Collections::IVectorView<bool>>' requested here
return wrap_pinterface<T>(instance);
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:1696:20: note: in instantiation of function template specialization 'py::wrap<winrt::Windows::Foundation::Collections::IVectorView<bool>>' requested here
return wrap(instance);
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/pybase.h:1913:30: note: in instantiation of member function 'py::converter<winrt::Windows::Foundation::Collections::IVectorView<bool>>::convert' requested here
return converter<T>::convert(instance);
^
C:/Users/Michel/git/python-winsdk/pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp:3030:28: note: in instantiation of function template specialization 'py::convert<winrt::Windows::Foundation::Collections::IVectorView<bool>>' requested here
return py::convert(self->obj.GetAsVectorView());
^
1 error generated.
nullptr one should be fixed now too
If we want to make sure we don't break builds with other compilers in the future, it would be nice to add a ci job for it in the pywinrt repo, preferably using https://github.com/marketplace/actions/setup-msys2#build-matrix.
Thanks for fixing this! I will look at the CI tomorrow.
I think all of the build issues are fixed now.
Hello, I noticed that if I don't precompile the headers (remove this line: https://github.com/pywinrt/python-winsdk/blob/main/CMakeLists.txt#L33), the build will fail with the following errors: