Error

Started by
2 comments, last by superpig 18 years, 8 months ago
can someone tell me what these mean. extra.obj : error LNK2005: "public: __thiscall extra::BoundingBox::BoundingBox(void)" (??0BoundingBox@extra@@QAE@XZ) already defined in engine.obj extra.obj : error LNK2005: "public: bool __thiscall extra::BoundingBox::isPointInside(struct D3DXVECTOR3 &)" (?isPointInside@BoundingBox@extra@@QAE_NAAUD3DXVECTOR3@@@Z) already defined in engine.obj extra.obj : error LNK2005: "public: __thiscall extra::BoundingSphere::BoundingSphere(void)" (??0BoundingSphere@extra@@QAE@XZ) already defined in engine.obj extra.obj : error LNK2005: "float __cdecl extra::GetRandomFloat(float,float)" (?GetRandomFloat@extra@@YAMMM@Z) already defined in engine.obj extra.obj : error LNK2005: "void __cdecl extra::GetRandomVector(struct D3DXVECTOR3 *,struct D3DXVECTOR3 *,struct D3DXVECTOR3 *)" (?GetRandomVector@extra@@YAXPAUD3DXVECTOR3@@00@Z) already defined in engine.obj extra.obj : error LNK2005: "unsigned long __cdecl extra::FtoDw(float)" (?FtoDw@extra@@YAKM@Z) already defined in engine.obj what does that error mean?
Advertisement
Yes. You're defining the functions BoundingBox, isPointInside, BoundingSphere, GetRandomFloat, GetRandomVector and FtoDw in a header file. This header file gets included by extra.cpp and engine.cpp, thus the functions get defined twice, one time in each file. Either make the functions inline, or keep their declarations in the header file and move their implementations into one source file (extra.cpp)

doh, I didnt even realize I was doing that. thank you very much. hey is there a tutorial on error, like what kinds of errors mean what. cuz to mea they are all just errors.
Look them up in MSDN. If you're using Visual Studio you should just be able to click on the error and hit F1.

If you understand how your tools work (in this case, the linker) then the errors will make a fair amount of sense without any further explanation. So it sounds like you don't need a tutorial on errors, you need an overview of what a linker is and how it works.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement