Sign in to follow this  

Unresolved external errors with common files

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been working from Beginning Direct3D Game Programming, and I've had to start from scratch after my installation of Visual Studio became corrupt. I have done everything in the book to configure Visual Studio, but when I add the common files to the project and try to build I get the following warnings and errors:
--------------------Configuration: DXPlayground - Win32 Debug--------------------
Compiling...
Playground.cpp
d3dapp.cpp
d3dutil.cpp
d3dfont.cpp
dxutil.cpp
Linking...
dxutil.obj : error LNK2005: _AtlIPersistStreamInit_Load@16 already defined in d3dutil.obj
dxutil.obj : error LNK2005: _AtlIPersistStreamInit_Save@20 already defined in d3dutil.obj
dxutil.obj : error LNK2005: _AtlIPersistPropertyBag_Load@20 already defined in d3dutil.obj
dxutil.obj : error LNK2005: _AtlIPersistPropertyBag_Save@24 already defined in d3dutil.obj
dxutil.obj : error LNK2005: _AtlGetObjectSourceInterface@20 already defined in d3dutil.obj
dxutil.obj : warning LNK4006: _AtlIPersistStreamInit_Load@16 already defined in d3dutil.obj; second definition ignored
dxutil.obj : warning LNK4006: _AtlIPersistStreamInit_Save@20 already defined in d3dutil.obj; second definition ignored
dxutil.obj : warning LNK4006: _AtlIPersistPropertyBag_Load@20 already defined in d3dutil.obj; second definition ignored
dxutil.obj : warning LNK4006: _AtlIPersistPropertyBag_Save@24 already defined in d3dutil.obj; second definition ignored
dxutil.obj : warning LNK4006: _AtlGetObjectSourceInterface@20 already defined in d3dutil.obj; second definition ignored
   Creating library Debug/DXPlayground.lib and object Debug/DXPlayground.exp
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXVec3Normalize@8
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXCreateTextureFromFileExA@56
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXAssembleShaderFromFileA@20
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixLookAtLH@16
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXQuaternionRotationAxis@12
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixTranslation@16
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixMultiply@12
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixTranspose@8
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixRotationQuaternion@8
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXQuaternionMultiply@12
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixInverse@12
d3dutil.obj : error LNK2001: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20
MSVCRTD.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/DXPlayground.exe : fatal error LNK1120: 13 unresolved externals
Error executing link.exe.
Creating browse info file...

DXPlayground.exe - 19 error(s), 5 warning(s)


Under Projects->Settings->Link I have
ddraw.lib d3d8.lib d3dxof.lib winmm.lib dxguid.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
Under Tools->Options->Directories tab I have c:\MSSDK\INCLUDE and c:\MSSDK\SAMPLES\MULTIMEDIA\COMMON\INCLUDE under include, c:\MSSDK\LIB under library, and c:\MSSDK\SAMPLES\MULTIMEDIA\COMMON\SRC under source. What have I left out or done wrong, and assuming I don't take my computer outside and repeatedly run over it in my truck what do I need to add or fix? [Edited by - Coder on August 20, 2004 10:21:54 PM]

Share this post


Link to post
Share on other sites
I think I found the problem. I was including the common files, and to make sure I had the right libraries linked I tried building without adding a main file. I removed the read only status from one of the example workspaces and took out every cpp file other than the common files and ended up with the same type of errors, only more of them.

Share this post


Link to post
Share on other sites
I'd strongly recommend trying to compile one of the samples that ships with the SDK; if the sample won’t compile then it’s probable that the Visual Studio directories don’t match the SDK directories. I noticed in your post that your directories are set to “C:\mssdk\...”; assuming you installed to the default location, those directories might match the SDK that came on a CD included with the book (I don’t own that book so I can’t say for sure), but that would mean the SDK you’re using is at least 2 years old. You might want to download the latest version from http://msdn.microsoft.com/directx and start from there.

Of course if the sample does compile then it’s simply a matter of making sure you’re linking to the same .lib files.

Hope that helps,

- Jon

Share this post


Link to post
Share on other sites
Thanks for your help. Is there any way to download just the libraries? Or is there more to the SDK than the library files, common files, and examples? I'm on dialup and it will take well over a full day to download the entire thing. The only reason I have the DX8 SDK is because it came with the book (which is the only reason I bought it. I learn more from the internet than I do from the book).

Share this post


Link to post
Share on other sites

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this