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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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