Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Are there any conventions to use if I were to distribute the source for a C++ library I built? The plan is to use CMake as a build system, but for the rest I was wondering what are the standards in terms of file/folder/subfolder naming, inclusion paths etc.

What I got so far:

  • Put everything in the $prefix folder under $prefix/bin, $prefix/include/libname and $prefix/lib.

  • Don't use caps for libname.

Should all internal includes contain the libname folder? E.g. say there are two files in the project: principal.h and secondary.h.

In principal.h, should the inclusion statement for secondary be : #include "secondary.h" or #include "libname/secondary.h"?

Are there other standards that should be followed? Why?

share|improve this question

migrated from unix.stackexchange.com Feb 14 '11 at 20:27

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

1 Answer 1

You could do worse than following chapter 7 of the GNU Coding Standards. It pretty much just distills standard practice.

You're welcome to disagree with any of it, of course. It's enough that you think through the issues and know why you're disagreeing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.