should i put .hpp and .cpp in the same fold or in ./src and ./hdr respectively?
it seems that separate them into src and hdr is a popular solution. however, this is not the case in Netbeans: by default, netbeans will put both hpp and cpp files in the same directory.
questions:
- 开发者_C百科
should I separate them or not? why?
if 1 is yes, is there any way to automatically set this in Netbeans?
If you plan to distribute a library as binaries and headers, it might be easier to have the headers in a separate directory to begin with.
Headers for private module stuff, should be with your code, public headers for the module should be separate.
This is a style preference, which means you should choose a style and stick with it. Different shops have different styles and best behavior is to adapt to their style when working on their projects.
For C++, I prefer to have the headers in the same directory as the source files. Many shops prefer to separate the header and source files into separate directories.
精彩评论