[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)
How to reuse code?
Hi all,
you seasoned VC++ coders must know the answer to this one...
Imagine that we have alpha.cpp+h, with a class used among
several projects.
Can i just put this file, and other files with commonly used
code in a single directory, where i can mess arround with the
code, and the other projects will get automatically updated?
(if i had alpha.cpp+h in each folder, and changed one, i would have to go folder by folder and change them all, right?)
So, basicly, we''re trying to create a centralized folder
for commonly used code, whats the best way to go about doing this?
And then, after creating a new project that will use alpha.cpp+h, what options must i set in the Project?
Do i have to point a setting to the folder where alpha.cpp+h is?
Thanx for the tips,
In VC++, if you go to the options dialog there is a tab called Directories. It has all of the folders that the compiler will look into when linking your project. If you add in your directory holding the files, and include them with angled brackets instead of quotes, then you''ll only need that one folder. I hope that made sense
You still have to add the files to the project, no?
And what about .DLLs and Libraries?
Doesn''t anyone use that?
Is it practical to pack a graphics engine into a .dll?
And what about .DLLs and Libraries?
Doesn''t anyone use that?
Is it practical to pack a graphics engine into a .dll?
[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)
If you have a common code base that everyone is working with, then yes put it all in a single directory. If at some point in the future you feel this code is stable and won''t need any modification, you can then just use the header file with the .obj or .lib file that you can create. And yes if you are going to be using the source file in your project, then you have to include it, along with the header. The header isn''t strictly necessary if you #include it, but it helps with auto sense.
---
Make it work.
Make it fast.
"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
---
Make it work.
Make it fast.
"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement