Я новичок, пожалуйста, помогите!winrt::fire_and_forget MainWindow::PlayGround_Loaded(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&)
{
Controls::ContentDialog playGameDialog;
playGameDialog.Title(box_value(L"Start Game?"));
playGameDialog.Content(box_value(L"Do you want to start the Snake Game now?"));
// Here's where I use winrt::make()
playGameDialog.Content(winrt::make());
playGameDialog.PrimaryButtonText(L"Yes!
playGameDialog.CloseButtonText(L"No");
playGameDialog.DefaultButton(Controls::ContentDialogButton::Primary);
// Set the XamlRoot. Without this, the dialog won't show
playGameDialog.XamlRoot(PlayGround().XamlRoot());
Controls::ContentDialogResult result = co_await playGameDialog.ShowAsync();
if (result == Controls::ContentDialogResult::Primary)
{
ResetGame();
StartGame();
// Giving focus to the MainGrid (for keyboard input)
MainGrid().Focus(winrt::Microsoft::UI::Xaml::FocusState::Programmatic);
}
// else, do nothing
}
< /code>
Где игровая площадка - это имя сетки, куда может перемещаться змея,
snake_exp - это имя проекта, а
startdialog - это страница.snake-exp\Generated Files\winrt\base.h(6972,69): error C2794: 'implements_type': is not a member of any direct or indirect base class of 'winrt::snake_exp::StartDialog'
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6972,69):
1> the template instantiation context (the oldest one first) is
snake-exp\MainWindow.xaml.cpp(73,39):
1> see reference to function template instantiation 'auto winrt::make(void)' being compiled
snake-exp\Generated Files\winrt\base.h(8027,67):
1> see reference to class template instantiation 'winrt::impl::implements_default_interface' being compiled
snake-exp\Generated Files\winrt\base.h(6994,58):
1> see reference to alias template instantiation 'winrt::impl::implemented_interfaces' being compiled
1> with
1> [
1> T=winrt::snake_exp::StartDialog
1> ]
snake-exp\Generated Files\winrt\base.h(6994,58): error C2938: 'winrt::impl::implemented_interfaces' : Failed to specialize alias template
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,58): error C2062: type '' unexpected
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,85): error C2039: 'first_interface': is not a member of '`global namespace''
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,103): error C2039: 'type': is not a member of '`global namespace''
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,103): error C2146: syntax error: missing ';' before identifier 'type'
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,103): error C2602: 'winrt::impl::implements_default_interface::type' is not a member of a base class of 'winrt::impl::implements_default_interface'
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(6994,15):
1> see declaration of 'winrt::impl::implements_default_interface::type'
snake-exp\Generated Files\winrt\base.h(6992,12):
1> see declaration of 'winrt::impl::implements_default_interface'
snake-exp\Generated Files\winrt\base.h(8029,81): error C2059: syntax error: ')'
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(8030,9): error C2143: syntax error: missing ';' before '{'
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(8032,26): error C2672: 'winrt::impl::make_factory': no matching overloaded function found
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(7966,10):
1> could be 'impl::implements_default_interface::type winrt::impl::make_factory(void)'
snake-exp\Generated Files\winrt\base.h(8032,26):
1> Failed to specialize function template 'impl::implements_default_interface::type winrt::impl::make_factory(void)'
snake-exp\Generated Files\winrt\base.h(8032,26):
1> With the following template arguments:
snake-exp\Generated Files\winrt\base.h(8032,26):
1> 'D=winrt::snake_exp::StartDialog'
snake-exp\Generated Files\winrt\base.h(8034,9): error C2181: illegal else without matching if
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(8046,20): error C2062: type '' unexpected
1>(compiling source file '/MainWindow.xaml.cpp')
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: Internal compiler error.
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: (compiler file 'D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\trees.c', line 21099)
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: To work around this problem, try simplifying or changing the program near the locations listed above.
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: If possible please provide a repro here: https://developercommunity.visualstudio.com
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: Please choose the Technical Support command on the Visual C++
snake-exp\Generated Files\winrt\base.h(8029,9): error C1001: Help menu, or open the Technical Support help file for more information
< /code>
Помогите мне!winrt::make
()< /code> дает ошибки сборки.
winrt::make()< /code> создает, но дает ошибки во время выполнения. < /p>
Вот некоторая информация о моих установленных продуктах:
Microsoft Visual Studio Community 2022
версия 17.14.8
VisualStudio.17.Release/17.14.836301.6
Microsoft .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net .net.net .net .net. 4.8.09032 < /p>
Установленная версия: Сообщество < /p>
Visual C ++ 2022 00482-90000-00000-AA232
Microsoft Visual C ++ 2022 < /p>
ASP.NET и Web Tools 17.14.114.53116
Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr /> Pr> />Azure App Service Tools v3.0.0 17.14.114.53116
Azure App Service Tools v3.0.0
C# Tools 4.14.0-3.25326.11+bd4f2062291278e0df1e3fd3180c0c862495a3a7
C# components used в IDE. В зависимости от типа и настройки проекта можно использовать другую версию компилятора. Linux Core Dumps. < /P>
Microsoft JVM Debugger 1.0
обеспечивает поддержку подключения Visual Studio Debugger с JDWP, совместимыми с Java Virtual Machines < /p>
Nuget Package Manager 6.14.0
Nuget Package Manager в Visual Studio. Для получения дополнительной информации о Nuget, посетите https://docs.nuget.org/
TypeScript Tools 17.0.40502.2001
TypeScript Tools для Microsoft Visual Studio
Visual Basic Tools 4.14.0-3.25326.11+BD4F2062291278E0DF1E3FD3180C0C862495A3A7
Компоненты Visual Basic, используемые в IDE. В зависимости от типа и настройки проекта и настройки, можно использовать другую версию компилятора.>
Подробнее здесь: https://stackoverflow.com/questions/797 ... nui-3-page
Мобильная версия