简体   繁体   中英

c++ including libs and adding directories for directX11

So I'm playing around with a DirectX tutorial trying to learn it but i keep getting these errors:

   1>main.obj : error LNK2019: unresolved external symbol _D3D11CreateDeviceAndSwapChain@48
   referenced in function "void __cdecl InitD3D(struct HWND__ *)" (?InitD3D@@YAXPAUHWND__@@@Z)
   1>main.obj : error LNK2019: unresolved external symbol _D3DX11CompileFromFileW@44 referenced in
   function "void __cdecl InitPipeline(void)" (?InitPipeline@@YAXXZ)

Now I am pretty sure this has something to do with including the rigth directories and libs ect. I have added the includes and set the linker options

 #include <d3d11.h>
 #include <d3dx11.h>
 #include <d3dx10.h>
 #pragma comment (lib, "d3d11.lib")
 #pragma comment (lib, "d3dx11.lib")
 #pragma comment (lib, "d3dx10.lib")

I have also set the the directories at configuration properties-> VSC++ directories -> Include directories and Lib. directories

Is there something else I'm missing?

Edit: Im using Visual Studio c++ 2010 express

1) check your linker settings, you need to add your libs there

2) are you building x86 or x64, depending on that the libs are in different folders

3) in vs2010 and before, you need directx sdk installed, comes together with vs2012 sdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM