src/ folder structure in C++?

前端 未结 6 1198
离开以前
离开以前 2021-02-02 00:01

i\'m coming into C++ from Java/AS3-land, and i\'m used to the package-cum-folder structure for my classes. and i like it.

i understand the very basics of namespaces in

6条回答
  •  眼角桃花
    2021-02-02 00:30

    You can arrange your files however you like; you'll just need to adjust your build tools' include paths and source paths to match.

    Giving each directory it's own namespace is overkill and probably a bad idea, as it will make for confusing code. I'd recommend one namespace per project at most, or even just one namespace per company (since presumably within your company you have the power to rename things if necessary to resolve name collisions. Namespaces' main purpose is to handle the case where two codebases under the control of two different organizations both use the same name, and you as a third party want to use them both in the same project, but don't have the ability to modify either codebase).

提交回复
热议问题