Question

I recently got Visual Studio on a new computer, and to set up DirectX on it, I went to Tools>Options>Projects and Solutions>VC++ Directories and under Library Files made a new entry C:\Program Files\Microsoft DirectX SDK (August 2009)\Lib\x86

and now ran a test program (essentially just initialized DirectX) and it worked fine. However, if I change ...\Lib\x86 to ...\Lib\x64, than I get a linker error that Direct3DCreate9 is undefined:

1>main.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
Was it helpful?

Solution

The x86 libraries are for 32-bit applications, and the x64 libraries are for 64-bit applications.

You can see which platform you are targetting in Visual Studio's Configuration Manager. Unless you have a good reason, you should be writing 32-bit applications, since 64-bit apps will require the 64-bit version of Windows to run.

OTHER TIPS

The x64 folder contains the library files for the AMD64 platform (Windows 64 Bit). You need to compile your application for 64 bit, too. Also, you need the 64 bit version of Windows to run the produced executable.

Well the simple answer is that the x86 libraries are for 32 bit operating systems and the x64 libraries are for 64 bit operating systems.

Simply changing the DirectX library linked to will produce an error as you are (in all probability) trying to link your 32 bit code to the 64 bit library. You will need to compile your code to target 64 bit operating systems to get this to link successfully.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top