1

I am trying to experiment on the DXGI APIs, and I was creating a console application that enumerates the available Adapters from the Factory Object.

The Code Snippet is as shown below:

// 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;
    }
}

But I am getting a Linker Error as follows:

error LNK2019: unresolved external symbol _CreateDXGIFactory@8

The headers that I have used are the following:

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

Am I missing something?

And thank you so much in advance for helping me out!

Ashik Unni
  • 55
  • 7

1 Answers1

6

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

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • 1
    Note that for various reasons, you should be using ``CreateDXGIFactory1`` or if you don't mind requiring Windows 8.1 or higher, use ``CreateDXGIFactory2`` – Chuck Walbourn Mar 20 '20 at 22:04