我在VC++ 2010中创建了控制台应用程序,并添加了以下代码:
#include #include #include #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; }
构建此项目时,我遇到了链接错误:error LNK2001: unresolved external symbol _IID_IDXGIFactory
现在我创建了带有MFC支持的控制台应用程序,并添加了相同的代码。该构建成功了。第一种情况出了什么问题?为什么MFC项目可以成功构建,而非MFC项目失败呢?
#include #include #include #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; }
构建此项目时,我遇到了链接错误:error LNK2001: unresolved external symbol _IID_IDXGIFactory
现在我创建了带有MFC支持的控制台应用程序,并添加了相同的代码。该构建成功了。第一种情况出了什么问题?为什么MFC项目可以成功构建,而非MFC项目失败呢?
dxguid.lib
是DirectX SDK库(而不是Windows SDK),据MSDN称,该符号已经在“核心”Windows SDK中了。 - Roman R.IID_ID3D11Device
和IID_ID3D11DeviceContext
也可以在dxguid.lib
中找到,而非 MSDN 指定的D3D11.lib
。 - SMUsamaShah