Dear rooters,
I’m trying to use g++ directly to compile my code and produce a stand-alone executable. Unfortunately I have run into an issue I don’t know how to solve. This is what I’m doing with my code:
g++ lvis_mol_lens.cxx read_inputs.cxx -o lvis_mol_lens -Wall -I /opt/root/include/root/ -L /opt/root/lib/root/
After this I’m getting this type of output:
/tmp/ccDvSTwe.o: In function `main':
lvis_mol_lens.cxx:(.text+0x37a1): undefined reference to `TVector3::TVector3(double, double, double)'
lvis_mol_lens.cxx:(.text+0x3828): undefined reference to `TVector3::TVector3(double, double, double)'
lvis_mol_lens.cxx:(.text+0x38a3): undefined reference to `TRotation::TRotation()'
lvis_mol_lens.cxx:(.text+0x3924): undefined reference to `TRotation::TRotation()'
lvis_mol_lens.cxx:(.text+0x3a55): undefined reference to `TVector3::SetTheta(double)'
lvis_mol_lens.cxx:(.text+0x3a9c): undefined reference to `TVector3::SetPhi(double)'
lvis_mol_lens.cxx:(.text+0x3aef): undefined reference to `TVector3::SetPhi(double)'
lvis_mol_lens.cxx:(.text+0x3b23): undefined reference to `TVector3::Unit() const'
....
Despite the fact the output doesn’t point to any line in particular, I’m certain the first few errors correspond to the following part in my code
....
TVector3 kmol[4]; // Wavevectors molasses
TVector3 w0molpos[4]; // Molasses beam waist position from center molasses reference frame
TRotation molrotz[4]; // Rotations to transform from center molasses reference frame to beam frame
TRotation molrotx[4];
double molwidth = 0; // Average beam width at molasses center
int i;
for ( i = 0 ; i < nmolbeams ; i ++ )
{
kmol[i].SetX( 1 );
kmol[i].SetMag( 1 / lam );
kmol[i].SetTheta( pi / 2 );
if ( i < 2 )
kmol[i].SetPhi( i * pi );
else
kmol[i].SetPhi( ( 2 * i - 3 ) * pi / 2 );
w0molpos[i] = - kmol[i].Unit();
....
My gut feeling is: “this is me not understand C++”
Please help!, any nudge in the right direction is greatly appreciated!
Thanks