[SOLVED]compiling multiple source files with ACLiC

Dear all,

In C++ you can partition your application/program in several source files. This is advantageous from the point of view that the code is more modular and easier to maintain.

I have a header file “read_inputs.h” with several function prototypes and a “read_inputs.cxx” file with the detailed functions. In standard C++, using g++ all I have to do is compile my main.cxx and read_inputs.cxx at the same time (provided I have the line #include “read_inputs.h” in both my cxx files) and everything works.

How do I do something similar using ACLiC?

I’ve simply tried .L main.C++, but it throws out errors saying i have undefined references to my functions (declared in the read_input files)


1 Like


[With ACLiC you want to avoid any routine called ‘main’, and thus in the following I assume that your main.cxx contains a routine called start].

You can accomplish what you need by either creating a wrapper file[code]// wrapper.C
#include “read_inputs.cxx”
#include “main.cxx”

#pragma link C++ function start;
#endif[/code]and the load (.L wrapper.C+) this wrapper script. Alternative (and better if you want to generate the dictionary for the content of the file) you can simply load them both in succession:.L read_inputs.cxx+ .L main.cxx+


Oh don’t worry. It’s actually called something different, I just used the word main for the discussion because it’s shorter.

Thanks a lot. Loading them in succession worked. I should have tried that, but I wasn’t sure.


Ok, I’m back with questions…

My files are:


lvis_mol_lens is basically a big function (with the same name) that takes several parameters as input.

I did it this way in order to run script using a bash script that changes the parameters sequentially. However, since I need to load the other file (read_inputs), this presents a problem for my bash script…

I suppose the way to work this out is using your wrapper script approach, but I’m afraid I don’t know what should be done. I guess the wrapper should accept inputs as well that I can then supply to the function? how can I accomplish this?

Thanks for your time


I suppose this will work:[code]#include “lvis_mol_lens.C”
#include “read_inputs.h”
#include “read_inputs.cxx”

// add here any needed #pragma

int wrapper( int arg = 0 , string region = “” , string type = “” , int ite = 0 , double step = 0 )
return lvis_mol_lens( arg , region , type , ite ,step);



worked very well after some tweaking