error LNK2019

Started by
6 comments, last by sarim 11 years, 9 months ago
Hey guys, i began work on an engine today using DirectX 10 but i ran into some sort of linking problem. I'm trying to initialize DX10 in my demo program using my engine so far and it keeps coming up with this error:


Error 1 error LNK2019: unresolved external symbol _D3D10CreateDeviceAndSwapChain@32 referenced in function "public: bool __thiscall dm::Graphics::Init_D3D(class dm::System *)" (?Init_D3D@Graphics@dm@@QAE_NPAVSystem@2@@Z) C:\Users\Sarim\Documents\Visual Studio 2010\Projects\DX10Game\DX10Game\DarkMatter.lib(DM_Graphics.obj)


I linked everything right in the "Additional Dependencies" and included "d3dx10d.lib" and "d3d10.lib" in both my engine project and my demoing program. My engine was working fine and i could use it all up until the point where i added the code to initialize Direct3D. Any help? And ill post code as needed if someone requests it.
Advertisement
Just because you didn't get a reply in 1 hour and 16 minutes doesn't mean you need to cross post.

Your linker is complaining that it can't find the definition of D3D10CreateDeviceAndSwapChain (this function requires you to link to D3D10.lib). The fact that it can't find this definition says that you are not, contrary to what you might think, properly linking to D3D10.lib.

I'm going to take a wild shot in the dark and guess (without more info): you haven't linked to it (i.e. you linked to it in Release but not Debug mode), or you're doing something like improperly mixing x86 and x64 libraries, or your library search paths are messed up so it can't find the library. It could be any of these, or it could be something else, but I can't say for sure without knowing more.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
In my "Additional Dependencies" in VS 2010 i have the following:

"d3dx10d.lib"
"d3d10.lib"
"DarkMatter.lib" (My engine)

My project is in Debug mode so i linked it to that too. And i don't know how i can mix x86 and x64 libraries when i checked my project properties carefully and made sure that everything is linked to the x64 library of DX10.

[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]I linked everything right in the "Additional Dependencies" and included "d3dx10d.lib" and "d3d10.lib" in both my engine project and my demoing program. My engine was working fine and i could use it all up until the point where i added the code to initialize Direct3D. Any help? And ill post code as needed if someone requests it.[/background][/font]


You will need to make sure the library location is in the "Additional Library Directories" path as well.
I put the library location in "Library Directories" In the VC++ tab already.

And i don't know how i can mix x86 and x64 libraries when i checked my project properties carefully and made sure that everything is linked to the x64 library of DX10.

Look carefully at the linker error: [font=courier new,courier,monospace]unresolved external symbol _D3D10CreateDeviceAndSwapChain@32[/font]. See that 32 at the end there? It's telling you it's looking for the function and it needs to be a 32 bit function. You're linking to the 64 bit libs. You need to link to the 32 bit libs. I'm going to take a wild guess that you have a 64 bit operating system but are making a 32 bit program. Either way though, it wants you to link to the 32 bit (x86) libs.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
ok so i've come to the conclusion that it's my Engine Project that is causing the problem because when i build it, i get some warnings concerning D3D10.lib.


1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(C:\Users\Sarim\Documents\Visual Studio 2010\Projects\DarkMatter\DarkMatter\.\Lib\DarkMatter.lib) does not match the Library's OutputFile property value (C:\Users\Sarim\Documents\Visual Studio 2010\Projects\DarkMatter\DarkMatter\DarkMatter.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
1>d3d10.lib(d3d10.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in d3dx10d.lib(d3dx10d_43.dll); second definition ignored
1>d3d10.lib(d3d10.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1> DarkMatter.vcxproj -> C:\Users\Sarim\Documents\Visual Studio 2010\Projects\DarkMatter\DarkMatter\.\Lib\DarkMatter.lib


On MSDN it says "To prevent this error, do not link a .obj with no public symbols into a library"...and i have no idea what that means. Does anyone know how to fix this warning? I think it's the main reason why i can't use it in my demo program.
You were right...thanks for your help really appreciate it man

This topic is closed to new replies.

Advertisement