using directory structure for file keeping

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Up till recently I only have done smallsih projects on smaller processors, So not a lot of code was present and also not to many files.

I recently started on something bigger ("filling up" a mega2560 ).

That gives a lot of files and now I want to put them in different sub directories.

 

what I do at the moment is:

- in studio first add a new folder,

- then put the files that have to be in that folder

till here to me it is clear that is is "work to be done to get things right, so no problem with that, but....

 

Then I also have to again add those directories in the compiler list

 

If I do not do that the files are not included in the project.

 

I wonder if there is a setting that I missed here, that will do this automatically, or a flag that automatically includes the sub directories.

 

hope someone can clarify things a bit and perhaps tell me that things can be done a lot easier.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure what your problem is? If you have .h files in different locations then, yes, you have to list all those locations for -I so that the compiler knows to go and look in each one in turn when the #include can not be resolved in the default directory. The other way is to use something like:

#include "display/display.h"
#include "keyboard/keyboard.h"
#include "general/general.h"
#include "ADC/ADC.h"
#include "Statmachine/Statemachine.h""
#include "TimerTick/Timertick.h"

Then the -I only needs to be told about the directory that is the common base for all these.

 

Another approach, that can save a lot of repetitive typing is:

 

where the $() entries are property sheet macros that have been predefined to be some very long directory names.

 

I can actually see in this example that \externals\ and even \externals\sim\ is common to a number so it might have an argument to define $(SimExternals) or something to be all of $(MTSIncludeDir)\externals\sim to save more typing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's the way I do it, I don't think it's wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

+1 for clawsons first suggestion.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

as said, doing things with multiple directories is new to me, and I was just thinking that I did things the hard way.

I thought that there perhaps was a 'magical' flag that would save me some time in having to go to the compiler settings everytime I create a directory, rename a directory, or create another sub level.

 

why think that?

well as I already create the directory in studio itself, so as such it can know that the directory is part of the build tree, after creating the directory I even have to add the files from that directory into the studio window in order to have them included in the project, again studio could have added that to the compiler settings.

So as effectively you seem tobe doing things double when first creating the directory inside studio and then again inside studio having to add that same directory into the compiler list, I was thinking I did something the (lats call it that)  stupid way and there could be an easy way to do it.

 

second I could just think that there was a setting were you just could tell the compiler, or have studio do it under the hood, that every single file in a directory and every single file in the sub directories that reside in the directory are tobe compiled and are part of the project. apparently I was thinking to easy there.

For a new project I will be going for cliff's #1 solution and add directory names to the include path.

 

Thanks for the clarification.

 

but at least I now know that I did not miss out on settings as I ran through them.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, sorry.. I read clawsons post sloppily. +1 for subdirs, include path to superdir and include directives with filespec relative to that. ONE include path to add to each new project. Sorry for the confusion..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]