Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved external symbol _IID_IDXGIFactory

I create Console Application in VC++ 2010, and add the following code to it:

#include <d3d10.h>
#include <d3dx10.h>
#include <DxErr.h>

#pragma comment(lib, "d3d10.lib")
#pragma comment(lib, "d3dx10.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "dxerr.lib")

int _tmain(int argc, _TCHAR* argv[])
{
    IDXGIFactory* pDXGIFactory;
    CreateDXGIFactory(IID_IDXGIFactory, ( void** )&pDXGIFactory);

    return 0;
}

Building this project, I have linker error: error LNK2001: unresolved external symbol _IID_IDXGIFactory

Now I create Console Application with MFC support, and add the same code. The build is successful. What is wrong in the first case? Why MFC project is built successfully, and non-MFC project fails?

like image 243
Alex F Avatar asked Dec 16 '22 02:12

Alex F


1 Answers

You need to reference another library, which holds this identifier:

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

MSDN says its DXGI.lib but effectively at least Windows SDK 7.0 has it in a different library.

like image 72
Roman R. Avatar answered Jan 07 '23 02:01

Roman R.