• ### What is your GameDev Story?

#### Archived

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

# Organizing libraries

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

## 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 on other sites
sounds good putting them into relevant directories

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

#include <sandhawk/network/socket.h>

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

##### 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

##### 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 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?

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 12
• 15
• 11
• 12
• ### Forum Statistics

• Total Topics
634153
• Total Posts
3015846
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!