🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Structuring C++ code (Visual Studio)

Started by
10 comments, last by matt77hias 6 years, 2 months ago
1 hour ago, Shaarigan said:

Going one step further, do never split header (.h) and implementation (.cpp) files because it is pure bad design to do so especially but not limited to greater projects! I always feel wasting my time to seek for the coresponding .h or .cpp files when investigating projects on GitHub.

I totally agree with this. If you want to develop a codebase (which both version control software such as Git and repository hosting systems such as Github support and facilitate), header files, template implementation files and implementation files should be put in the same directory for ease of use during development.

If you want to distribute your API, you only provide an Include directory containing the header files and template implementation files, and a binary .lib. And of course, you could add a script to your codebase to automate this stripping and building.

Unfortunately, many C++ Github repositories aim at distribution and integration into external projects instead of development of the internal projects themselves.

 

 

🧙

This topic is closed to new replies.

Advertisement