View Full Version : directx linker error
September 22nd, 2002, 02:18
i have been programming c++ for awhile now, and recently decided that it was time to move past windows and make purdy things with dx8, so i bought myself a book and downloaded the SDK and everything... when i compiled my first program, however, i got this linker error:
Directx Graphics error LNK2019: unresolved external symbol _Direct3DCreate8@4 referenced in function "public: long __thiscall D3DWindow::SetupDirect3D(void)" (?SetupDirect3D@D3DWindow@@QAEJXZ)
now i know that that error means that i probably misspelled something, but i double checked everything... in desperation, i tried to compile the first tutorial in the SDK, but that 2 gave me the same link error - funny thing is, when i compile advanced samples from the SDK sample base, they link fine, which means im linking the right files i think...
the only thing i can think of is that im using c++ .net, and the directx SDK was designed for c++ 5 or 6 ... could that be the problem? any ideas anyone?
September 22nd, 2002, 09:48
I recently got a little bit into this whole .net-stuff and read about several linker-switches concerning switching .net-stuff on/off. Maybe there's a switch you left on. (Just a guess.)
September 23rd, 2002, 01:11
did you make sure to include the D3D library in your project? (That one caused similar problems for me a while back)
September 23rd, 2002, 02:37
yes i did - i have both the library files and the include files referenced... i know for sure that they are working because i can compile the advanced D3D samples in the SDK, like the water demo or the dolphin demo, but when i try to write the most basic of D3D windows (create a blank window which does nothing but write to the backbuffer) i get that linker error - it doesn't apparentally like the Directx8::Create function, cause thats where the error is occuring, actually its these two lines exactly:
HRESULT D3DWindow::SetupDirect3D (void)
/* Create the Direct3D object */
if( NULL == ( g_pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
//those two lines in this class create the error, nothing else...
/* Get the current display mode so we know what bitdepth we are */
if (FAILED (g_pD3D->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &d3ddm) ) )
/* Fill in the present parameters */
ZeroMemory( &d3dpp, sizeof(d3dpp) );
/* We want windowed mode */
d3dpp.Windowed = TRUE;
/* Discard this */
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
/* Same format as the current format
(we got this from g_pD3D->GetAdaptorDisplayMode) */
d3dpp.BackBufferFormat = d3ddm.Format;
/* Create the device */
&g_pD3DDevice ) ) )
i mean thats nothing comlex at all... now so i think it was a problem with my program, so i go and compile the very first sample in the SDK tutorial series, and that is essentially an exact copy of this program, and it gives me the same linker error... so i guess it has to be a compatibility problem between the SDK (designed for c++ 6) and .net, but i have no idea how to fix it...
oh nezzar what do you mean about linker-switches??? i don't know anything about ordering the linker around, aside from link this, lol
September 23rd, 2002, 13:04
By switches I mean there are several (command-line?) switches that change the behaviour of the linker concerning .net-stuff.
September 25th, 2002, 04:11
oh i understand what you mean - actually im trying to get around the linker error by using the "/force" switch on the command line to force it to link despite the external error... i'll get back to you guys after i try it...
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.