|STAR Computing||Tutorials main page|
|How to Convert C code for C++ Compilation|
| ||Maintained by Lee Barnby|
This page outlines the steps to follow in converting your C code for compilation by a C++ compiler. The motivation for doing this is that compilation will then be stricter as explained in Valeri's email to starsoft-l. The list is a product of my experience in converting the code in
pams/global/egr/track_propagator.c and I will use that as an example.
The steps are:
stardevso that when it comes to compile and test your code the most up to date libraries are used, minimizing the chance of conflicts.
cons +pams/global. This is optional but by doing this you check that it does compile to start with which can save you work later on.
track_propagator.cc, following the naming conventions in our coding standards document
cons -noR +pams/global. The option
consnot to use the repository. If you omit this instead of compiling your new C++ file it will use the original C file from the repository.
extern void prop_circle_param_();which gives and error at the line where you call it such as "Error: Too many arguments in call to prop_circle_param_()".
extern "C" void prop_circle_param_(float *trk , float *xc, float *r);
addof the new files and a CVS
removeof the old .c files. CAUTION Once you do this you cannot re-introduce your original .c file to cvs in the normal way.