Followers 0

# error LNK2019

## 7 posts in this topic

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:

[CODE]
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)
[/CODE]

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.
0

##### Share on other sites
Just because you didn't get a reply in 1 hour and 16 minutes doesn't mean you need to [url="http://www.gamedev.net/topic/626971-error-lnk2019/"]cross post[/url].

Your linker is complaining that it can't find the definition of D3D10CreateDeviceAndSwapChain ([url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb205087(v=vs.85).aspx"]this function requires you to link to D3D10.lib[/url]). 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.
1

##### Share on other sites
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.
0

##### Share on other sites
[quote name='KrNaGe' timestamp='1340662443' post='4952813']
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][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][/size][/font][/color][/quote]
You will need to make sure the library location is in the "Additional Library Directories" path as well.
0

##### Share on other sites
I put the library location in "Library Directories" In the VC++ tab already.
0

##### Share on other sites
[quote name='KrNaGe' timestamp='1340669400' post='4952840']
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.
[/quote]
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.
2

##### Share on other sites
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.

[CODE]
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
[/CODE]

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.
0

##### Share on other sites
You were right...thanks for your help really appreciate it man
0

## Create an account

Register a new account