I have the following sort of directory structure: part1 build src part2 build sr
ID: 655501 • Letter: I
Question
I have the following sort of directory structure:
part1
build
src
part2
build
src
Now I have a header file that I would like to include in both parts of these projects, it will contain constants and some macro definitions as well as some utility functions, and I want these to be synchronized between the two parts. What would be the generally acceptable way to format my directory structure?
Something like so?
part1
build
src
part2
build
src
share
src
and set up my make files in the build directories to also look in ../../share/src
Or is there a more "correct" way of doing this?
Explanation / Answer
That's how I've done it in many projects.
Dare I say "self-documenting"?
It makes it completely clear to anyone looking at this what's going on.
And that includes you.
Imagine yourself going off to work on some other, completely unrelated project for three/ four years and then coming back to this one. All those little snippets and assumptions and "understandings" that you work with day-in, day-out, today will all be long forgotten. it'll be like coming to this code completely cold. It's not nice finding hidden "nasties" in code, is it? So; try not to leave any for yourself.