我知道头文件如何在 C++ 中工作的机制,但我刚刚开始编写包含大量类的更大的 opengl 程序,我想知道是否存在围绕头文件组织更大程序的“标准”或传统方式或者这在很大程度上只是个人喜好?
最佳答案
1. Divide your project into Modules. 2. Make a directory for each module. 3. Under each directory for a module create 2 sub directories inc/ and src/ where you will place your header and source files resp. 4. Create a global directory and place your header and cpp files in that directory which would be used commonly by several modules. 5. Make your Makefile that includes path and links to all libraries correctly.
这就是我所遵循的。可能还有其他效率更高和效率更低的方法:)
关于c++ - 常规的c++程序头文件结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7592145/