I'm on Linux with C::B version 10.05.
After adding any file, the "compile file" and "link file" flags are set to true (ticked). Only my main.cpp should get built - it has #include statements that pull in all other files recursively. All library include lines (such as "#include <vector>" and "#include <iostream>") are at the top of main.cpp and nowhere else - the compiler fails due to this, since it wrongly tries to build bus.cpp first (alphabetical). Vector is not defined, cout is not defined, etc. The compiler only needs to build main.cpp.
In the project file manager I can right click on each individual file, select properties, go to the Build tab, uncheck "compile file" and "link file". That works. I have some projects though with up to 100 source files - that is going to take too long.
How can I change which files get built? When adding, the only option is telling C::B which targets the file should belong to. If I select no targets, it just asks again until I pick one or more. Surely I'm missing something here.
If I understood correctly, you have a project which includes 100 files more or less, but you want to build one file at a time so you may see the actual output of each file? Am I correct?
If that is the case, well I don't know of any different way other than remove the files from project, (which does not delete them from project directory, just to let you know to have no worries) and include each file one-by-one and compile it upon request.
Now, about your building issue with header files, I would suggest to follow the well-known concept
Declaration / Implementation / Use; that is, in your
Declaration [header] file(s), declare your structures / classes, function prototypes, and include the necessary header files which implementation files will going to use. Then, in your
implementation file call your own header file that includes the aforementioned information, and in your use file, that is your
main.cpp, you may include your header file to generate the desire linkage so it can produce the executable.
I hope it make sense to you.
Cheers.
P.S.: If you need me to produce a tiny demo for you, please by all means, do not hesitate to ask me so I can gladly create it for you.