wrl.h C7510报错

 

以上是初始化D3D12编译时报错

根据微软官网的说法

https://docs.microsoft.com/zh-cn/cpp/overview/cpp-conformance-improvements?view=vs-2017

/permissive- 模式下,编译器现在要求在依赖的嵌套名称说明符之后的模板名称前添加 template 关键字。

/permissive- 模式下,以下代码现在会发出 C7510:'example': use of dependent template name must be prefixed with 'template'. note: see reference to class template instantiation 'X<T>' being compiled

template<typename T> struct Base
{
    template<class U> void example() {}
};

template<typename T>
struct X : Base<T>
{
    void example()
    {
        Base<T>::example<int>();
    }
};

若要修复此错误,请将 template 关键字添加到 Base<T>::example<int>(); 语句中,如下面的示例所示:

template<typename T> struct Base
{
    template<class U> void example() {}
};

template<typename T>
struct X : Base<T>
{
    void example()
    {
        // Add template keyword here://///////////////////////////////////////////
        Base<T>::template example<int>();
    }
};


所以修改两行代码,在event.h中 back前添加 template
编译器就不再报错
posted @ 2020-08-25 19:05  Victor2k  阅读(250)  评论(0)    收藏  举报