UWP:在两个页面之间实现基本导航会导致错误?

UWP: Implementing basic navigation between two pages results in an error?

所以我来自 Windows 表格,我正在尝试在 Visual Studio 2017 年为我的 raspberry pi [=29 创建一个 UWP(通用 Windows 程序) =] Windows 物联网。我需要弄清楚如何使用一个程序创建多个 windows,所以我按照 Microsoft 的教程进行了操作:https://docs.microsoft.com/en-us/windows/uwp/design/basics/navigate-between-two-pages。从理论上讲,它应该编译得很好,但是,它 returns:

Error   C2065   'Page2': undeclared identifier (page1.xaml.cpp) 
Error   C2653   'Page2': is not a class or namespace name (page1.xaml.cpp)
Error   C2065   'Page1': undeclared identifier (page2.xaml.cpp)
Error   C2065   'Page1': undeclared identifier  NavApp1 (app.xaml.cpp)
Error   C2653   'Page1': is not a class or namespace name (page2.xaml.cpp)
Error   C2653   'Page1': is not a class or namespace name (app.xaml.cpp)

我的代码:(Page1.xaml.cpp):

#include "Page2.xaml.h" #include "pch.h" #include "Page1.xaml.h"
void NavApp1::Page1::HyperlinkButton_Click(Platform::Object^ sender,
Windows::UI::Xaml::RoutedEventArgs^ e)
{ this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(Page2::typeid)); }

我的代码:(Page2.xaml.cpp):

#include "Page1.xaml.h" #include "pch.h" #include "Page2.xaml.h"
void NavApp1::Page2::HyperlinkButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(Page1::typeid));}

回答:我可以通过输入

来解决这个问题
#include "Page1.xaml.h"
#include "Page2.xaml.h"

#include 下的所有 .cpp 文件 pch.h