Archived

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

Tron3k

Reusable files

Recommended Posts

When you have cpp and h files that you use a lot, do you just copy them to each project when you need to use them, or do you do like: #include "c:\tron\modules\clog.h" (ie. you have a folder where you put all of them and include it directly from there). The problem with the second method is if you change it drastically it won''t work anymore, but the problem with the first method is if you add something useful, you have to recopy it to the project folder. What do you guys do? Firebird Entertainment

Share this post


Link to post
Share on other sites
quote:
Original post by elis-cool
I copy, its no big deal

The problem comes when you have two projects that are using the same shared file. If you modify it and forget to copy the file back, you might modify the other one next and you'll be in a big mess. Besides, why copy files around if you can reference the same file?
quote:

also some stuff may vary slightly from project to project...


If you have to 'slightly' change common files to suit different projects, then they are not really common. They have have project-dependent specifics that prevent them from being truly common. They are more like 'parts of a specific project that can be used in other projects with certain modifications' than 'common files that can be used in any project (within reasonable constraints, of course) for whatever they are doing'.

[edited by - IndirectX on June 8, 2002 10:21:11 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Actually, I have a local SourceSafe server set up and I share the header across projects in SourceSafe.

Source control is your friend.

Share this post


Link to post
Share on other sites
If something is truly worth sharing, move it out of the first project''s directory and into a MyLibraries directory where you can keep all your shared stuff. That also ensures that deleting 1 project doesn''t break any others.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files ]

Share this post


Link to post
Share on other sites
if you use stuff alot, like initialization code for DirectX or OGL, just make a library, then make calls to it, alot simpler, and i think it''s alot cleaner. Just my 2.49183 Japanese Yen ( two cents for you who are too lazy to go see what it equals

Share this post


Link to post
Share on other sites