开发者

should i put .hpp and .cpp in the same fold or in ./src and ./hdr respectively?

开发者 https://www.devze.com 2022-12-13 06:51 出处:网络
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.

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:

  1. 开发者_C百科

    should I separate them or not? why?

  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号