开发者

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:

  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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜