6

主な記事には、ヘッダーファイルソースファイルがあります。これらの2つのファイルをコピーし、いくつかのヘッダーを追加した後:

#include <Windows.h>
#include <d2d1.h>
#pragma comment(lib, "d2d1")
#include <dwrite.h>
#include <d2d1helper.h>
#include "SafeRelease.h"

//安全な解放ファイル

template<class Interface>
inline void
SafeRelease(
    Interface **ppInterfaceToRelease
    )
{
    if (*ppInterfaceToRelease != NULL)
    {
        (*ppInterfaceToRelease)->Release();

        (*ppInterfaceToRelease) = NULL;
    }
}

このプロジェクトをコンパイルしようとすると、エラーが発生します。

エラー1エラーLNK2019:関数 "private:long __thiscall SimpleText :: CreateDeviceIndependentResources(void)"(?CreateDeviceIndependentResources @ SimpleText @@ AAEJXZ)で参照される未解決の外部シンボル__imp__DWriteCreateFactory @ 12

理由がわからない。全て?ヘッダーが含まれています。うまくいけば、あなたの何人かはこれを手伝うことができるでしょう。
ありがとうございました。

4

3 に答える 3

18

You need to link to Dwrite.lib, which includes the implementation of DWriteCreateFactory

See here for documentation. Requirements section at the bottom explains what you need to include and link to to use the function that the error refers to.

You could probably fix this by adding the line

#pragma comment(lib, "Dwrite")
于 2010-07-21T09:42:52.890 に答える
1

追加後:

#pragma comment(lib, "dwrite")

このコードは機能します。

于 2010-07-21T09:45:37.427 に答える
1

アプリケーションにリンクするライブラリのリストでDwrite.libに言及する必要があります。

于 2010-07-21T09:52:37.993 に答える