创建UWP cppwinrt SolidColorBrush的生成错误 [英] Errors on build creating a UWP cppwinrt SolidColorBrush

查看:133
本文介绍了创建UWP cppwinrt SolidColorBrush的生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为文本块创建实心画笔(cppwinrt)时,使用以下命令生成错误:

When creating a solid brush (cppwinrt) for a textblock I get errors when building, using:

void MainPage::myStyle(Controls::TextBlock & block)
{   
    block.FontSize(72.0);
    block.Foreground(Media::SolidColorBrush(Windows::UI::Colors::Orange()));
    block.VerticalAlignment(VerticalAlignment::Center);     
}   




错误:LNK2019无法解析的外部符号 public: __thiscall winrt :: Windows :: UI :: Xaml :: Media :: SolidColorBrush :: SolidColorBrush(struct winrt :: Windows :: UI :: Color const&)

error: LNK2019 unresolved external symbol "public: __thiscall winrt::Windows::UI::Xaml::Media::SolidColorBrush::SolidColorBrush(struct winrt::Windows::UI::Color const &)"

当我拿出固体刷并且我也尝试了其他版本的固体刷时,错误就出了错。

The error goes when I take the solidbrush out and I've also tried other versions of the solidbrush with the same error.

推荐答案

您需要

#include <winrt/Windows.UI.Xaml.Media.h>

使用命名空间 winrt :: Windows :: UI :: Xaml中的类型:: Media 。在 C ++入门中对此进行了说明/ WinRT


每当您要使用Windows名称空间中的类型时,都应包括相应的C ++ / WinRT Windows名称空间标头文件,如图所示。相应的标题是与该类型的名称空间同名的标题。例如,要对 Windows :: Foundation使用C ++ / WinRT投影:: Collections :: PropertySet 运行时类, #include< winrt / Windows.Foundation.Collections.h>

这篇关于创建UWP cppwinrt SolidColorBrush的生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆