首页 文章

错误C2664:无法将'IDWriteFactory2 **'转换为'IUnknown **'

提问于
浏览
1

以下的mwe基本上是从this example中提取的 . 完整的示例编译并正常工作,但我的mwe不能使用Visual Studio 2013编译,我不明白为什么不 .

#include <dwrite_2.h>
#include <atlbase.h>

using namespace std;


void main()
{
    IDWriteFactory2* m_spdwriteFactory;

    DWriteCreateFactory(
    DWRITE_FACTORY_TYPE_SHARED,
    __uuidof( IDWriteFactory2 ),
    &( m_spdwriteFactory )
    );
}

错误消息显示:

------ Build build:项目:测试,配置:调试x64 ------ 1> Source.cpp 1> Source.cpp(16):错误C2664:'HRESULT DWriteCreateFactory(DWRITE_FACTORY_TYPE,const IID& ,IUnknown **)':不能将参数3从'IDWriteFactory2 **'转换为'IUnknown **'1>指向的类型不相关;转换需要reinterpret_cast,C风格的转换或函数式转换==========构建:0成功,1失败,0最新,0跳过==========

1 回答

相关问题