What is the proper way to structure C++ macros with modularity in mind?


ROOT Version: 6.34.08 (Yes, I know this is not the latest version)
Platform: NixOS Linux, x86_64
Compiler: Cling (if that is the default when nothing has been done to change it)

This installation of ROOT is from Nixpkgs, though I don’t think that’s relevant.

UNNECESSARY BACKGROUND INFORMATION:
Please be forewarned, this question is going to seem very stupid. I’m using this program for a very simplistic purpose compared to what it’s normally used for, to do homework for an introductory statistics course, specifically to gain experience working with C++ and CLI applications. I am neither a professional nor a student in experimental physics, I’m a computer science nerd who saw that there was a masterfully efficient calculator that was entirely text based and had to be programmed with C++ and just had to learn how to use it.

THE ACTUAL QUESTION:

I would like some advice on how to structure my C++ macros so that I can use them to modularly define series of operations on one dimensional vectors of type double. Originally, I just put each function into its own .C file, splitting them up as best I could so that any code I thought I’d need to use twice would be its own .C file with one singular function within it. All of these .C files would be in this one folder I called “ws” for “workspace”, and that’s where I would use them and build new functionality out of these base atomic functions.

However, the problem: I can’t #include a file that’s already included in another file that is also included, so if I want to use two files that both use the same file, I’m out of luck. That’s when I realized I was probably structuring my code VERY wrong or there’s some trick I need that I don’t know about. I would like to know how a modular structure is supposed to be achieved in this unique environment.