When trying to compile project in vs2022, I get the error LNK2019 unresolved external symbol CreateDXGIFactory referenced in function main. I have including the win10 sdk and know that the file is linking because I am getting inline hints.
#include <iostream>
#include <dxgi.h>
#include <dxgi1_2.h>
#include <dxgi1_3.h>
#include <dxgi1_4.h>
#include <dxgi1_5.h>
#include <dxgi1_6.h>
#include <dxgicommon.h>
#include <dxgidebug.h>
#include <dxgiformat.h>
int main()
{
UINT i = 0, j = 0, k=0;
IDXGIFactory* pFactory = nullptr;
IDXGIAdapter* pAdapter;
IDXGIOutput* pOutput;
if (CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory)) == S_OK)
{
while (pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND)
{
while (pAdapter->EnumOutputs(j, &pOutput) != DXGI_ERROR_NOT_FOUND)
{
++j,k;
pOutput->Release();
}
j = 0;
++i;
pAdapter->Release();
}
std::cout << j << std::endl;
pFactory->Release();
}
else
{
std::cout << "Err creating dxgi factory" << std::endl;
}
return 0;
}