Reusable files

Started by
8 comments, last by Tron3k 21 years, 10 months ago
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
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Advertisement
The include way. If you change something for the better, the old project(s) will benefit from the changes as well.
---visit #directxdev on afternet <- not just for directx, despite the name
OK, well I guess I''m going to have to change everything then, because I''ve been doing the copying thing. Thanks for your advice.

Firebird Entertainment
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
I copy, its no big deal, and if you end up changing something wrong you have a backup... also some stuff may vary slightly from project to project...

CEO Plunder Studios
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
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]
---visit #directxdev on afternet <- not just for directx, despite the name
Create an own folder within your Visual C++ include folder and off you go..

just my 2 cents,
cya,
Phil


Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Actually, I have a local SourceSafe server set up and I share the header across projects in SourceSafe.

Source control is your friend.
How about putting them in a dll.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
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 ]
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

This topic is closed to new replies.

Advertisement