AnsweredAssumed Answered

How do you structure folders for a project?

Question asked by Dave Jones on Mar 6, 2017
Latest reply on Mar 6, 2017 by Dave Jones

I notice that in the example projects within the STM32L4 firmware package that all the examples have a parent folder that contains a SRC folder with the C files, and INC folder with the local include files, and a project folder that has the .project and .cproject files. Then in the project all of the C files and headers are linked with relative links, relative to the project folder.

 

When I took one of the examples and exported it as an archive and placed it elsewhere, the archive created a different structure. It created folders within the project folder for all the C files. Both the local ones and the external shared ones. It didn't export any header files at all. So the resulting project was broken and I had to go find all the header files. I placed them in an "includes" folder within the project folder, next to the various folders holding the C files. When I did that the project seemed to automatically assume they were source files and included that folder in the project. Not in the "Includes" virtual folder for headers, directly under the project name, but as a regular folder full of source files just like the various source folders full of C files. I then had to select it and exclude it from the build in order to not have it all automatically added.

 

I'm guessing that if I had created that include folder in a parent directory outside the project folder then that wouldn't have happened. But then if the norm is to put all source and headers outside the project folder, why did creating the archive place all of the C files in folders within the project folder? And why didn't the archive add any .h files?

 

So, how do you normally structure your files/folders for your projects?

Outcomes