При создании сплошной кисти (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
. Это задокументировано под Начать работу с 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>
.