无法解析的外部符号_IID_IDXGIFactory [英] Unresolved external symbol _IID_IDXGIFactory
问题描述
我在VC ++ 2010中创建控制台应用程序,并向其中添加以下代码:
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;
}
正在构建此项目,我有链接器错误:错误LNK2001:无法解析的外部符号_IID_IDXGIFactory
Building this project, I have linker error: error LNK2001: unresolved external symbol _IID_IDXGIFactory
现在,我创建具有MFC支持的控制台应用程序,并添加相同的代码.构建成功.第一种情况有什么问题?为什么MFC项目建立成功,非MFC项目失败?
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?
推荐答案
您需要引用另一个包含此标识符的库:
You need to reference another library, which holds this identifier:
#pragma comment(lib, "windowscodecs.lib")
MSDN说,其 DXGI.lib
,但实际上至少Windows SDK 7.0在不同的库中具有它.
MSDN says its DXGI.lib
but effectively at least Windows SDK 7.0 has it in a different library.
这篇关于无法解析的外部符号_IID_IDXGIFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!