Error Lnk2019 Unresolved External Symbol _direct3dcreate9
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow error lnk2019 unresolved external symbol __declspec(dllimport) the company Business Learn more about hiring developers or posting ads with us Stack
C++ Error Lnk2019 Unresolved External Symbol
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of error lnk2019 unresolved external symbol public 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How do I solve LNK2019 for Direct3DCreate9? up vote 2 down vote favorite During compile time I get error lnk2019 unresolved external symbol winmain@16 referenced in function ___tmaincrtstartup the following error: RAT_RendererDX9.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: void __thiscall RAT_ENGINE::RAT_RendererDX9::Init(class RAT_ENGINE::RAT_WindowManager *)" (?Init@RAT_RendererDX9@RAT_ENGINE@@QAEXPAVRAT_WindowManager@2@@Z) The only place that I use Direct3DCreate9 is in my Init() function of the Renderer which has the following code: void RAT_RendererDX9::Init(RAT_WindowManager* argWMan) { wMan = argWMan; g_pD3D = (LPDIRECT3D9)Direct3DCreate9( D3D_SDK_VERSION ); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof( d3dpp ) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; g_pD3D->CreateDevice( D3DADAPTER_DEFAULT,
Error Lnk2019 Unresolved External Symbol Visual Studio 2010
D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice ); } Where does this error come from and how can I solve it? I've tried the other answers to LNK2019, but they didn't resolve my problem. c++ visual-c++ directx directx-9 share|improve this question edited Feb 3 '13 at 0:03 GSerg 47.9k775128 asked Feb 3 '13 at 0:01 Friso1990 364421 You need to link in the directx library. –Alexey Frunze Feb 3 '13 at 0:08 5 Add d3d9.lib to the linker's additional dependencies. –Hans Passant Feb 3 '13 at 0:10 I've already used #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this error lnk2019 unresolved external symbol public __thiscall referenced in function _main site About Us Learn more about Stack Overflow the company Business Learn more error lnk2019 unresolved external symbol void __cdecl about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Error Lnk2019 Unresolved External Symbol Main Referenced In Function __tmaincrtstartup
Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 2 x “LNK2019: http://stackoverflow.com/questions/14667945/how-do-i-solve-lnk2019-for-direct3dcreate9 unresolved external symbol” errors when compiling up vote 0 down vote favorite I get the below two linking errors when I try to compile in VS 2010. I have ensured that my include & library settings are correct in the project properties > VC ++ Directories & also checked to make sure that Project > Linker > Input has d3d9.lib & d3dx9.lib in it http://stackoverflow.com/questions/14446887/2-x-lnk2019-unresolved-external-symbol-errors-when-compiling which it does. I've also tried adding #pragma comment for the two above libraries in D3DGraphics.h but to no avail :( The compile errors.... 1>D3DGraphics.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: long thiscall D3DGraphics::SetupD3D(struct HWND *)" (?SetupD3D@D3DGraphics@@QAEJPAUHWND__@@@Z) 1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall FIREWORKCLASS::FIREWORKCLASS(struct IDirect3DDevice9 *)" (??0FIREWORKCLASS@@QAE@PAUIDirect3DDevice9@@@Z) referenced in function "void __cdecl SetupFirework1(void)" (?SetupFirework1@@YAXXZ) ... : fatal error LNK1120: 2 unresolved externals Full program structure below... D3DGraphics.h #include
is defined globally as a LPDIRECT3D9 and I've included d3d9.h but I'm getting this error message: 1\>main.obj : error LNK2019: unresolved external symbol \_ referenced in function \_ Any ideas what's wrong? I remember I got the same error before when I did this but I can't remember http://forum.devmaster.net/t/unresolved-external-symbol--direct3dcreate9-4/9988 how I solved it. Thanks in advance monjardin 2006-06-08 14:02:24 UTC #2 It looks like you aren't linking to the D3D libraries... gmax136 2006-06-08 14:38:38 UTC #3 add to object/libraries: d3d9.lib Qlone 2006-06-09 15:06:43 UTC #4 ... or add the .lib file to your solution, or #pragma comment(lib, "d3d9.lib") in the header file of your pogram... so may ways poita 2006-06-10 07:16:03 UTC #5 Oh ok. I was under the impression that including the header file allowed you to use error lnk2019 those functions. What exactly does linking to the library do? [EDIT] Thanks btw! baldurk 2006-06-10 09:40:09 UTC #6 @poita Oh ok. I was under the impression that including the header file allowed you to use those functions. What exactly does linking to the library do? [EDIT] Thanks btw! The way the build system works is in a couple of major parts (not counting the preprocessor and suchlike). First, the compiler will take the raw source code and convert it into error lnk2019 unresolved an object file. This is why you need to include header files. The header files contain the declarations of the functions you're using. ie. the header files say to the compiler, "there is such a function matching this prototype - if it gets used, don't give an error". If you didn't include the header, or used the function wrongly, the compiler would tell you about it. However, these object files themselves don't make your program. That's why you need the linker. The linker takes the object files and combines them into the final executable. It also defines in the executable every single function your program calls. So if you call printf, it defines that your program needs to link to the standard c library at runtime (which I think is msvcrt on windows - MS visual c run time?). Then, if you call Direct3DCreate9 the linker will define that you need to link against d3d. However, it can't work that out automatically. You need to tell it that you're using d3d in your program. That way it can resolve all the symbols in the object files and properly link your program. When your program gets run then, all these defined libraries get loaded (or, if already loaded, linked in) and so you can call these funtions as normal. That's assuming you're using dynamic linking, which I guess you probably are . poita 2006-06-11 11:02:42 UTC #7 Thanks