Ask Your Question
2

why are .h and .cpp separate in the directory structure?

asked 2014-06-27 17:09:33 -0500

Bob Dean gravatar image

Way back in the days of yore, I remember automake separated src and include so that it could install headers with a single -r. CMake on the other hand, allows you to directly install each file into its own special spot. If this is the case, why separate src and include? For a small project it's not a big deal, for larger projects it can be cumbersome (personal opinion).

is there a REP for this that i missed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-06-28 09:56:53 -0500

dornhege gravatar image

Usually the include path is passed to other projects for inclusion. This makes it easy to provide only the interface for your node that you'd want. As far as I know there is no REP. You can also have headers in the src and it will still work. In my opinion for larger projects not separating the headers would be cumbersome.

edit flag offensive delete link more

Comments

1

Typically you put all your public facing headers in one place for easy browsing/access. And all your private headers and source are in our source space and don't get installed. It's also much easier to write one install rule for a directory than for every individual header in a package.

tfoote gravatar imagetfoote ( 2014-09-26 19:03:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-27 17:09:33 -0500

Seen: 677 times

Last updated: Jun 28 '14