axodox / unpaint

A simple Windows / Xbox app for generating AI images with Stable Diffusion.
Other
273 stars 12 forks source link

Failed to build the project #37

Closed catoxliu closed 1 year ago

catoxliu commented 1 year ago

Follow the steps and installed all required package. Updated all nuget packages to latest. Windows 11 Visual Studio 2022 17.6.4

errors:

1>pch.cpp
1>C:\workspace\github\unpaint\packages\Axodox.Common.1.0.23\include\Infrastructure\Logger.h(27,48): error C2039: 'format_string': is not a member of 'std'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\numeric(23): message : see declaration of 'std'
axodox commented 1 year ago

It still works in 17.6.2, I will update and recheck.

axodox commented 1 year ago

I have updated VS and it still compiles. Are building using the public nuget packages, or do you use locally built versions? Have you applied any change to the code?

catoxliu commented 1 year ago

@axodox , thanks for your quick reply.

Are building using the public nuget packages, or do you use locally built versions?

using public nuget packages, all update to latest. image

Have you applied any change to the code?

No, just change the certificate as the documentation suggested.

image

All the google results point that compiler should use C++ 20, which I have checked and confirmed

image

Here's the whole build log, there're other errors but all related to the precompiled header. unpaint_build.log

catoxliu commented 1 year ago

Some update.

Since you mentioned build the module locally, so I tried to build "axodox-common" as well, having the same error. So I go to "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.34.31933\include\format" to have a look, because according to https://en.cppreference.com/w/cpp/utility/format/basic_format_string, it should be in that header file.

But yeah, it's not there, instead I find the equivelent declaration in that file

template <class... _Args>
using _Fmt_string = _Basic_format_string<char, type_identity_t<_Args>...>;

So yeah, by replaceing these two line I can get "axodox-common" compiled successfully now

     template<typename... TArgs>
-    void log(log_severity severity, const std::format_string<TArgs...> format, TArgs&&... args) const
+    void log(log_severity severity, const std::_Fmt_string<TArgs...> format, TArgs&&... args) const^M
     {
...
     template<typename... TArgs>
-    void log(log_severity severity, const std::wformat_string<TArgs...> format, TArgs&&... args) const
+    void log(log_severity severity, const std::_Fmt_wstring<TArgs...> format, TArgs&&... args) const^M
     {

Then I go back to unpaint project and use the same change. Now I only get this error message: 1>C:\workspace\github\unpaint\Unpaint\SettingsViewModel.cpp(24,40): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'winrt::Unpaint::AdapterViewModel' 1>C:\workspace\github\unpaint\Unpaint\SettingsViewModel.cpp(24,40): message : Invalid aggregate initialization 1>C:\workspace\github\unpaint\Unpaint\SettingsViewModel.cpp(74,5): error C2440: 'return': cannot convert from 'std::wstring' to 'winrt::hstring' 1>C:\workspace\github\unpaint\Unpaint\SettingsViewModel.cpp(74,5): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Update: these two errors are easy to fix, can't use wstring directly, has to make it raw string by c_str(). So I finally get it compiled locally : )

All this seems to be that I'm not using the right version of MSVC? would you mind to point which version you're using? thanks Never mind, using 14.36.32532 MSVC just without any issues. I don't know why my installer choose an old version for me... Close the issue. Thanks