Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Organization of files in Code Blocks

I am currently working on a medium/large project on Code::Blocks and I am wondering how to organize my files.

First, it seems that creating "virtual folders" in Code::Blocks is quite natural but then on disk, all files are in the root folder of the project and it seems messy for me : if I want to do something outside of Code::Blocks, files are then hard to find. Should I use this method anyway ?

Then if I create "real" folders every time I need them, I need to add them to the path in order for them to be built. Plus, Code::Blocks seems not to like that. Is there an easy way to say to Code::Blocks "build the project as if the files in the sub-folders in my project directory where directely inside the root project directory" ?

I did not find on the Internet how project are usually organized with Code::Blocks, any links are welcomed

like image 515
Bérenger Avatar asked Feb 22 '13 14:02

Bérenger


2 Answers

large projects organisation

If you are creating a new project, coding a new software application or want to refactor existing code, it's a good to properly structure your project. While there is probably hundreds of ways to structure and while there are many thing to consider, here I would like to give you one possible approach which has really worked for me over and over. This example/proposal is the summary of the years of research I have done regarding this topic, so it's not just 'an idea'

There are three 'main' issues you definitely need to address when organising a project:

Medium to large projects, not to say all projects, should be version controlled (GIT as an example).

medium to large projects, not to say all projects, should be maintained by a project generator (Cmake as an example).

It would be impossible, for a medium to large project, to keep all files in the same physical directory. It is even strongly discouraged (by several guidelines including linux kernel). You should organize these files in a physical logical manner.

An example physical projects file structure would be:

~example/environment$project tree .
.
|- code
     |- core
     |- extern
|- docs
|- tests
     |- core_tests
     |- extern-tests
|- ...

This, unfortunately in code::blocks, means you will have to include all your project physical folders to the search paths.

You can organize your files inside code::blocks in any way you want, virtually too, but if your physical structure is logical, your project should be intuitive to browse!

code::blocks does not allow to include virtual paths.

hope this helps

KR

Hewi

like image 57
2 revs Avatar answered Sep 23 '22 11:09

2 revs


In one of my projects in Code::Blocks I use different folders in my source folder; client, common and server.

I then have different compile targets, so that the client compile target will use the source files found in client and common, and the server compile target will use the source files found in server and common.

Not sure if that's what you're after but here is a picture of how my project looks like: enter image description here

like image 43
Arnestig Avatar answered Sep 25 '22 11:09

Arnestig