Jump to content
  • Advertisement

Archived

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

Sand_Hawk

Organizing libraries

This topic is 5733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote over the past week a couple of usefull classes. Most are in a source and header but the 2 templated are only inside a header. These libraries are mostly reusable pieces of code. However, I do not want to store them inside the directory of the project where they were initially where written for. So far I have them all stored inside
F:\Projects\Headers\
 
so I can do #include <header.h> and add them easily to my workspace. However, the number of headers in there are growing pretty quick now since I need way more libs for my upcoming project. What is the best way of storing them? Have for each libarary a subdir with it''s name (e.g \MySQL\*.cpp and *.h) or just all of them inside the \headers\ folder? And how do you store your libraries? Sand Hawk ---------------- -Earth is 98% full. Please delete anybody you can.
My Site

Share this post


Link to post
Share on other sites
Advertisement
sounds good putting them into relevant directories

remember when you #include them use ''/'' rather than ''\''

it makes your code portable

#include <sandhawk/network/socket.h>

if you used ''\'' then the ''\n'' in sandhawk\network would cause problems on sytems where \n means newline

Share this post


Link to post
Share on other sites
http://davepermen.homeip.net/libs/ is an additional standart folder for visual studio, so i can include gl/gl.h, sdl/sdl.h, boost/shared_ptr.hpp and that stuf
http://davepermen.homeip.net/projects/ is where i have my projects in.. headers with reuse get nice written and formatted put into
http://davepermen.homeip.net/dsp/

thats about it.. you can browse there to see it all..

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
If I add F:\Projects\Libraries\ to VC, will this also search all the subdirectories or not? If so, I could just #include <cWinSock.h> instead of the entire map. And also, the precompiler will also under ''\\'' instead of ''/''.

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site

Share this post


Link to post
Share on other sites
quote:
Original post by Sand_Hawk
If I add F:\Projects\Libraries\ to VC, will this also search all the subdirectories or not?


No, subdirectories are not searched. It''s still a good idea to use multiple subdirectories. Just specify the (relative) path of the header in the include directive (as petewood suggests).

For example, if you have the header cWinSock.h in the directory F:\Projects\Libraries\Net\ and F:\Projects\Libraries\ is in the include path for VC, then include the file with

#include "Net/cWinSock.h"

quote:

And also, the precompiler will also under ''\\'' instead of ''/''.


Yes, but a backslash is not the path separator on all platforms. A slash (''/'') is more portable, and also less to write than two backslashes, so why not just use it?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!