当为文本块创建实心画笔(cppwinrt)时,我在构建时会遇到错误,使用:
void MainPage::myStyle(Controls::TextBlock & block)
{
block.FontSize(72.0);
block.Foreground(Media::SolidColorBrush(Windows::UI::Colors::Orange()));
block.VerticalAlignment(VerticalAlignment::Center);
} 错误:未解决的外部符号"public: winrt::Windows::UI::Xaml::Media::SolidColorBrush::SolidColorBrush(struct winrt::Windows::UI::__thiscall const &)“
当我取出solid刷子时,这个错误就会发生,我也用相同的错误尝试过其他版本的solid刷子。
发布于 2018-10-27 16:06:05
你需要
#include <winrt/Windows.UI.Xaml.Media.h>使用名称空间winrt::Windows::UI::Xaml::Media中的类型。这是在开始使用C++/WinRT下面记录的。
每当您想使用Windows命名空间中的类型时,请包括相应的C++/WinRT Windows名称空间头文件,如图所示。对应的标头与类型的命名空间具有相同的名称。例如,要为Windows::Foundation::Collection::PropertySet运行时类
#include <winrt/Windows.Foundation.Collections.h>使用C++/WinRT投影。
https://stackoverflow.com/questions/53022168
复制相似问题