Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


error LNK2019


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Cryptiik   Members   -  Reputation: 440

Like
0Likes
Like

Posted 25 June 2012 - 02:58 PM

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.

Sponsor:

#2 Cornstalks   Crossbones+   -  Reputation: 6991

Like
1Likes
Like

Posted 25 June 2012 - 04:31 PM

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.
[ 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 ]

#3 Cryptiik   Members   -  Reputation: 440

Like
0Likes
Like

Posted 25 June 2012 - 06:10 PM

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.

#4 DevLiquidKnight   Members   -  Reputation: 834

Like
0Likes
Like

Posted 25 June 2012 - 09:12 PM

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.

You will need to make sure the library location is in the "Additional Library Directories" path as well.

#5 Cryptiik   Members   -  Reputation: 440

Like
0Likes
Like

Posted 26 June 2012 - 09:23 AM

I put the library location in "Library Directories" In the VC++ tab already.

#6 Cornstalks   Crossbones+   -  Reputation: 6991

Like
2Likes
Like

Posted 26 June 2012 - 09:35 AM

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: unresolved external symbol _D3D10CreateDeviceAndSwapChain@32. 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.
[ 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 ]

#7 Cryptiik   Members   -  Reputation: 440

Like
0Likes
Like

Posted 26 June 2012 - 09:40 AM

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.

#8 Cryptiik   Members   -  Reputation: 440

Like
0Likes
Like

Posted 26 June 2012 - 09:45 AM

You were right...thanks for your help really appreciate it man




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS