Thread: [GD-General] Practical Game Structure.
Brought to you by:
vexxed72
From: Chris B. <Chr...@ma...> - 2002-01-13 23:14:52
|
In the beginning of my current project I attempted to create structure within my project by using static libs. However as the project grew and the number of static libs grew my grand plan of structure has become a bit wobbly. For example: OpenGL Renderer is dependent on Common, Graphics and Renderer. Graphics is dependent on Common. Renderer is dependent on Application, Graphics, Video and Resource Manager. Application, Video and Resource Manager are all dependent on Common. Common includes things like expat and zlib + ~50 other classes. From this you can assume that just about everything uses common. The problem is that since common is included and included again and again I seem to be getting linker warnings about multiply defined symbols. I've been looking for an answer to this for months, not because I get a few warnings and it looks messy, rather I get 4000 warnings and it takes a -long- time for them to be displayed, long enough that it's probably doubling my build time. Originally I went with this structure to reduce the amount of unused code that gets linked to all my DLL's (one for each renderer, mixer, input system etc). I'm happy to hear from anyone who can either suggest a better structure or knows how to turn a linker warning off. I'm using .NET but this problem was with me under VC6 too. Many thanks Chris NOTICE This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank. |
From: Kent Q. <ken...@co...> - 2002-01-14 03:55:01
|
We use a similar structure, where different libraries are dependent on each other, especially including util. But I consider a multiple definition warning to be an error and eliminate it. We don't have this problem. Just because a library is dependent on another library doesn't mean that the code gets included multiple times. I'm guessing that you're defining objects in include files instead of in code. If you have something like this: //-----idnumber.h------ class IdNumber { public: static int id = 1; }; change it to this: //-----idnumber.h------ class IdNumber { public: static int id; }; //-----idnumber.cpp------ #include <util/IdNumber.h> int IdNumber::id = 1; You *don't* want that definition to show up more than once when you link. Kent Chris Brodie wrote: > > In the beginning of my current project I attempted to create structure within my project by using static libs. However as the project grew and the number of static libs grew my grand plan of structure has become a bit wobbly. > > For example: > > OpenGL Renderer is dependent on Common, Graphics and Renderer. Graphics is dependent on Common. Renderer is dependent on Application, Graphics, Video and Resource Manager. Application, Video and Resource Manager are all dependent on Common. Common includes things like expat and zlib + ~50 other classes. > > >From this you can assume that just about everything uses common. The problem is that since common is included and included again and again I seem to be getting linker warnings about multiply defined symbols. I've been looking for an answer to this for months, not because I get a few warnings and it looks messy, rather I get 4000 warnings and it takes a -long- time for them to be displayed, long enough that it's probably doubling my build time. > > Originally I went with this structure to reduce the amount of unused code that gets linked to all my DLL's (one for each renderer, mixer, input system etc). > > I'm happy to hear from anyone who can either suggest a better structure or knows how to turn a linker warning off. I'm using .NET but this problem was with me under VC6 too. > > Many thanks > > Chris > > NOTICE > This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank. > > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general -- ----------------------------------------------------------------------- Kent Quirk | MindRover: "Astonishingly creative." Game Architect | Check it out! ken...@co... | http://www.mindrover.com/ _____________________________|_________________________________________ |
From: Stefan B. <sbo...@te...> - 2002-01-15 16:31:36
|
> >From this you can assume that just about everything uses common. The > problem is that since common is included and included again and again I > seem to be getting linker warnings about multiply defined symbols. I've > been looking for an answer to this for months, not because I get a few > warnings and it looks messy, rather I get 4000 warnings and it takes a - > long- time for them to be displayed, long enough that it's probably > doubling my build time. Let me guess... you have included the Common static lib as a dependency in your other static lib projects?? Don't :) Cheers, Stef -- Stefan Boberg - R&D Manager, Team17 Software Ltd. bo...@te... |
From: Stefan B. <sbo...@te...> - 2002-01-15 17:00:28
|
> Let me guess... you have included the Common static lib as a > dependency in your other static lib projects?? Don't :) Sorry, that got sent before I was finished!! Let me elaborate: in Visual Studio, for some obscure reason it appears as though the librarian/linker/whatever actually pulls in all object files from static libraries that are in your dependency list for the Visual Studio project and bundles them into your freshly created static library. God knows why... I really can't see any scenario where that would be useful. Or perhaps I am just operating the machinery wrong? Cheers, Stef! :) -- Stefan Boberg - R&D Manager, Team17 Software Ltd. bo...@te... |
From: Erwin de V. <er...@vo...> - 2002-01-16 00:18:51
|
No, you're right about this. I've had the same problem before. Very annoying indeed. I just wanted to fix this asap, because it was taking a lot of time to display those damn warnings. It could be useful to merge several libraries into a single library though. Imagine a single shipping product for developers to use. Now YOU may want to split them in several pieces for convenience, but the end user doesnt want to know that! They dont like linking with 20 libraries at all! =) It should be an option though. (Like a lot of things!) Erwin ----- Original Message ----- From: "Stefan Boberg" <sbo...@te...> To: <gam...@li...> Sent: Tuesday, January 15, 2002 18:00 Subject: RE: [GD-General] Practical Game Structure. > > Let me guess... you have included the Common static lib as a > > dependency in your other static lib projects?? Don't :) > > Sorry, that got sent before I was finished!! Let me elaborate: in > Visual Studio, for some obscure reason it appears as though the > librarian/linker/whatever actually pulls in all object files from static > libraries that are in your dependency list for the Visual Studio project > and bundles them into your freshly created static library. God knows > why... I really can't see any scenario where that would be useful. > > Or perhaps I am just operating the machinery wrong? > > Cheers, > Stef! :) > -- > Stefan Boberg - R&D Manager, Team17 Software Ltd. > bo...@te... > > > > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > > |