gpt4 book ai didi

uwp - 构建创建 UWP cppwinrt SolidColorBrush 时出错

转载 作者:行者123 更新时间:2023-12-02 00:28:02 34 4
gpt4 key购买 nike

为文本 block 创建实心画笔 (cppwinrt) 时出现错误,使用:

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

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

当我取出 solidbrush 时出现错误,我也尝试过其他版本的 solidbrush 出现相同的错误。

最佳答案

你需要

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

使用来自命名空间 winrt::Windows::UI::Xaml::Media 的类型.这记录在 Get started with C++/WinRT 下:

Whenever you want to use a type from a Windows namespaces, include the corresponding C++/WinRT Windows namespace header file, as shown. The corresponding header is the one with the same name as the type's namespace. For example, to use the C++/WinRT projection for the Windows::Foundation::Collections::PropertySet runtime class, #include <winrt/Windows.Foundation.Collections.h>.

关于uwp - 构建创建 UWP cppwinrt SolidColorBrush 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53022168/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com