CreateDXGIFactory 函数抛出链接器错误

CreateDXGIFactory function throws Linker Error

我正在尝试在 DXGI API 上进行试验,我正在创建一个控制台应用程序来枚举来自工厂的可用适配器 Object。

代码片段如下图:

// pFactory and vecAdapters are initialized as static variables

// Snippet from a static function 
HRESULT result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&pFactory);
if (result == S_OK) {
    UINT i = 0;
    IDXGIAdapter* pAdapter;
    while (pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND) {
        vecAdapters.push_back(pAdapter);
        ++i;
    }
}

但我收到如下链接器错误:

error LNK2019: unresolved external symbol _CreateDXGIFactory@8

我用过的headers如下:

#include <Windows.h>
#include <dxgi.h>
#include <dxgi1_2.h>
#include <vector>

我错过了什么吗?

非常感谢您对我的帮助!

#pragma comment(lib, "dxgi.lib")