Jump to content
xisto Community
Vyoma

Organizing C++ Project Files For Large Projects (source code, header, makefiles)

Recommended Posts

Is there any online resource or documentation I can look at, which gives standards or best-practices in terms of organizing the source code for C++ projects?My day job has kept me away from C++ and into Java for quite some time now, and I see there has been a lot of work in terms of standardizing C++ during that time.To illustrate, looking up Sun's documentation, I know that I should put my Java projects (for POJOs) as follow http://forums.xisto.com/no_longer_exists/- source files ( containing more subfolder like /src/com/example for namespace of com.example.*)/build - intermediate files used by Ant build.xml/cfg - configuration and .property files/lib - any third-party libraries used/scripts - invokers for Linux/Unix boxesIs there any similar standard being followed for C++ projects? I am thinking of working on a Gtkmm based project, and if my prototyping gives good results, I would put it out as OpenSource (GPL perhaps). Since it could potentially be used and developed upon by others, I want to make sure I follow the standards and do not do a bad start.

Share this post


Link to post
Share on other sites

Everything is inside the makefile (or Makefile) file.
There are mainly "best practices" everybody know, and each time I have to put my nose inside I say "why did he not do like me ?"
However, I would say it differently :
- not /src, but /home/mythings/src
I would like to suggest you to see how a well-known opensource software distro is organized.
Have a look at imagemagick instructions here : http://forums.xisto.com/no_longer_exists/
and download their source distro from here http://www.imagemagick.org/script/download.php
Download the source, and see how it's organized, and have a look at the makefile.
The best thing is to organize it the same way, in such a way that you simply have to untar, then make, and make install, and in case of error "make clean".

Share this post


Link to post
Share on other sites

Ayaaa! I think I wrote it wrongly when I was showing what I was doing with my Java projects. When I said /src, I should have actually said, '/my-home-folder-path/java-workspace/specific-project/src'. Instead of '/lib', I should have said, '/my-home-folder-path/java-workspace/specific-project/lib' and so on. :rolleyes:Hmmm - I think I will do that. Thanks for the imagemagick link. May be I will check out some other OpenSource projects too which are implemented in C++ (know of any?).

Share this post


Link to post
Share on other sites

May be I will check out some other OpenSource projects too (know of any?).

Have a look at PostGreSQL, it's a nice implementation. I don't remember whether it's C or C++, but from the implementation point of view it's very nice.For instance I appreciate the fact that the final test says "Sorry, you are the root user, you should not" and you simply have to restart everything as a standard Unix user ! :rolleyes:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.