
[英]How to add a reference to Windows Runtime Component (C++/WinRT) in my .Net Framework project
[英]How to import into a C++/WinRT project a UserControl from a windows runtime component written in C#?
我的解决方案中有一个非常简单的用C#编写的Windows运行时组件项目,在其中添加了要导出到C ++ / WinRT项目的UserControl
。 当导入到另一个C#项目中时,此组件工作正常,但是当我尝试在我的C ++ / WinRT项目中导入和使用它时出现编译错误。
\my_project\generated files\xamltypeinfo.g.cpp(1313): error C3083: 'my_component_XamlTypeInfo': the symbol to the left of a '::' must be a type
我添加了对该组件的引用,并在我的pch.h
添加了以下包含,以为它可以解决该问题:
#include "winrt/my_component.h"
但随后出现以下编译错误:
\my_project\generated files\xamltypeinfo.g.cpp(1306): error C3083: 'my_component_XamlTypeInfo': the symbol to the left of a '::' must be a type
我注意到,如果包含标头,也会出现: #include "winrt/data_grid.data_grid_XamlTypeInfo.h"
我不再遇到编译器错误,但是在尝试实例化组件时,应用程序在启动时崩溃。
将包含XAML的Windows运行时组件导入C ++ / WinRT应用程序的正常过程是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.