Archived

This topic is now archived and is closed to further replies.

Linker errors by the bag full

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

Recommended Posts

I realise that this problem has graced these boards a number of times, but it seems it has caught me out this time. I have started a new project to begin using what I have learned to make something useful, but ye olde linker has had at me with quite a large hurty stick. I have used the directx application wizard (don't hate me for that) which worked fine, but in order to keep things centralised, I have started to remodel the app with a single global header file, which looks something like :

#ifndef __WIZARDIO_
#define __WIZARDIO_

#define INITGUID

#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <assert.h>
#include <basetsd.h>
#include <mmsystem.h>

#include <d3d8.h>
#include <d3dx8.h>
#include <rmxfguid.h>
#include <rmxftmpl.h>

// Global definitions

//#define VertexFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
#define VertexFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE)

//typedef

struct sVertex{
FLOAT x, y, z;
D3DCOLOR diffuse;
//FLOAT u, v;

};

#include "mysprite.h"

void DebugPrint( TCHAR* strMsg, ... );

// Useful Macros (the useless ones have been cut)

#define ReleaseCOM(x) if(x) { x->Release(); x = NULL; }

#include "D3DApp.h"
#include "D3DFont.h"
#include "D3DFile.h"
#include "D3DUtil.h"
#include "DXUtil.h"
#include "D3DRes.h"
#include "resource.h"
#include "wizard.h"

#include "mysprite.h"

#endif

For my troubles, I get a plethora of linker errors. Here is a sample : d3dfile.obj : error LNK2005: "unsigned char * D3DRM_XTEMPLATES" (?D3DRM_XTEMPLATES@@3PAEA) already defined in d3dapp.obj d3dfile.obj : error LNK2005: _TID_D3DRMRightHanded already defined in d3dapp.obj d3dfile.obj : error LNK2005: _TID_D3DRMPropertyBag already defined in d3dapp.obj d3dfile.obj : error LNK2005: _TID_D3DRMStringProperty already defined in d3dapp.obj d3dfile.obj : error LNK2005: _TID_D3DRMExternalVisual already defined in d3dapp.obj Well, you get the idea. Anyway, some tips on how to fix this problem would be greatly appreciated. Thanks, Steele. Edit: source tags [edited by - Crow-knee on February 3, 2003 4:17:12 AM] [edited by - Crow-knee on February 3, 2003 4:18:34 AM]

Share on other sites
I would put a bet (although small) that you define something in your headers, and thus it''s defined in more than one of your object files. You must only declare stuff in your headers.

Share on other sites
It''s possible that d3dapp.h already includes d3d8.h, d3d8x.h...(and so on and so forth). If it does you only need to include d3dapp.h and not the rest...
Hope this helps at least a little bit

Share on other sites
quote:
Original post by gargoylle_ltk
It's possible that d3dapp.h already includes d3d8.h, d3d8x.h...(and so on and so forth). If it does you only need to include d3dapp.h and not the rest...
Those headers are standard headers, right? If so, they should have inclusion guards. But, that should not cause the errors he sees anyway, as they clearly indicates that he has defined the same identifiers multiple times in the same project.

[edited by - CWizard on February 3, 2003 4:45:24 AM]

Share on other sites
By the way d3dapp.h is included I think it is generated "on the fly" by the wizard. If so, it might (MIGHT) include the other standard headers thus making re-inclusion not necesary...
(please note that I have never use the wizard so I''m basicaly just guesing here :D )

Share on other sites
Yep.
Even my header files have inclusion guards.
Could there be a project setting (VC++ 6.0) that I have forgotten about? I have a project almost identical, which does not get these linker errors.
The thing is, I don''t get an error about any of my definitions or types, just those defined in the standard DX8 headers. I''m using DX8.1 if that makes a difference. The errors are pretty much all of the _TID_*, _IID_*, _CLSID_CDirectXFile and D3DRM_XTEMPLATES.
I have been over the header files directly included into my project multiple times, and there are no instanciations of variables that I can see (externs used appropriately). The header file inclusions have all been taken out.

Most troublesome.
Thanks for the quick replies.
Steele.

Share on other sites
I would take a closer look at "mysprite.h" (which you include twice in that file).

Share on other sites
No idea really, but the errors clearly indicates that something that is defined in d3dfile.cpp (d3dfile.obj) has already been defined in in d3dapp.cpp (d3dapp.obj). I have no idea what sort of crap VC is generating for you, but it shouldn''t define anything in a header.

If you want, send the project to my email address (in profile), and I''ll check and see if I can catch it.

Share on other sites
Oh yes. I did include it twice. A cut and paste mistake.
Here is the mysprite header anyway. The errors still occur without it though. 431 errors down from 517.

  #ifndef __MYSPRITE_#define __MYSPRITE_class c_Sprite {public:	bool Init(IDirect3DDevice8 *d3dDevice, sVertex sVerts[], long VertNum);	MoveTo(float x, float y, float z);	MoveBy(float x, float y, float z);	RotateX(float rads);	RotateY(float rads);	RotateZ(float rads);	bool Draw(IDirect3DDevice8 *d3dDevice);	Update();	~c_Sprite();protected:	float xPos, yPos, zPos;	float xRot, yRot, zRot;	float xScale, yScale, zScale;	D3DXMATRIX matWorld;	IDirect3DVertexBuffer8 *VB;	D3DMATERIAL8 mtrl;};#endif

Still puzzles me...

Share on other sites
quote:
Original post by Crow-knee
Still puzzles me...
Me as well

What source files are in the project, and do they include anything else besides you''re global header?

Has this been a problem since you started the project? If not so, try to remember what you added to cause these errors.

1. 1
2. 2
JoeJ
20
3. 3
frob
20
4. 4
5. 5

• 10
• 11
• 12
• 13
• 9
• Forum Statistics

• Total Topics
632210
• Total Posts
3004817

×