Compiling several source (main and headers) files and linking them?

Suppose I have a main macro named “macro.cpp” and two headers “h1.cpp” (contains the definition of a function) and “h1.h” containing the declaration of the function defined in “h1.cpp” similarly I have “h2.cpp” and “h2.h”. The main program “macro.cpp” calls those functions inside “h1” and “h2”. I was successful compiling the source files using:

.L h1.cpp+
.L h2.cpp+
.L macro.cpp+

which generated three .so files “, and”. I want to know what to do with them ? How do I link them so that I have something like a “macro.out” or something like that (a single executable file) which I can execute (I don’t know how !) and do whatever I wished to do with the macro.

Note: If I just load all the files using .L file_name.cpp etc and just execute the main macro using .x macro.cpp then everything works fine and I have results, but this is not what I want ! I want to compile like we do in usual g++ and by the way in every forum everyone keep advising on compiling using .L file_name.cpp+ or ++ … I would really like to know the whole story… because nobody seems to explain beyond .L file_name.cpp+ … what next ? What to do with the .so etc.

Thanks a lot

This is a duplicate of Compiling several source (main and headers) files and linking them? .

I know, I have just joined Root Talk and posted the topic in ROOT Support didn’t get any response in two days so thought I posted in a wrong forum :confused: and hence re-posted today in CINT Support forum and got immediate response. I do not understand well the fine line between ROOt, CINT etc, well I don’t even understand ROOT… hence this “duplicate” problem ! I will be more careful in the future :slight_smile: now I can’t delete it so marking it “solved” !