"undefined reference to"-error.. - SOLVED

hello;

i want to compile a script i’ve written. the code works fine with CINT, but when i’m trying to compile it, i get an error.

that’s my script which i want to compile:

#include “iostream.h”
#include “iomanip.h”
#include
#include “stdio.h”
#include “TROOT.h”
#include “TApplication.h” //vBu
#include “TCanvas.h” //vBu
#include “TPolyLine.h” //vBu
#include “TColor.h” //vBu
#include “TGeoManager.h”
#include “TGeoMaterial.h”
#include “TGeoMedium.h”
#include “TGeoVolume.h”
#include “TStyle.h”
#include “TSystem.h”

int main(int argc, char **argv)
{
TROOT root (“test program”,“test”);
TApplication appl(“testhallo1”,&argc,argv);
gStyle->SetCanvasPreferGL(true);
gSystem->Load(“libGeom”);
TGeoManager *geom = new TGeoManager(“simple1”, “Simple geometry”);
TGeoMaterial *matVacuum = new TGeoMaterial(“Vacuum”, 0,0,0);
TGeoMaterial *matAl = new TGeoMaterial(“Al”, 26.98,13,2.7);
TGeoMedium *Vacuum = new TGeoMedium(“Vacuum”,1, matVacuum);
TGeoMedium *Al = new TGeoMedium(“Root Material”,2, matAl);
TGeoVolume *top = geom->MakeBox(“TOP”, Vacuum,2000.,2000.,1000.);
geom->SetTopVolume(top);
top->SetVisibility(kFALSE);
TGeoVolume tub[10];
for (Int_t tnr=0; tnr<10; tnr++)
{
tub[tnr] = geom->MakeBox(“tub”, Al, 2, 2, 200);
top->AddNode(tub[tnr],tnr, new TGeoTranslation(6
tnr, 0, 0));
}
geom->CloseGeometry();
geom->SetVisLevel(3);
top->Draw(“ogl”);
appl.Run();
}

(don’t care about all the includes - as long as they do not harm)

and that is the error, i get (it’s always the same, i think):
Asim/eventm.cc:24: undefined reference to TGeoManager::TGeoManager(char const*, char const*)' Asim/eventm.cc:25: undefined reference toTGeoMaterial::TGeoMaterial(char const*, double, double, double, double, double)’

same error for TGeoTranslation and so on, so there must be a basic error in my syntax, i think !?

so, what am i doing wrong?
asim.

[size=75]if you want to see, want the script should do, here’s my CINT-version:

{ gROOT -> Reset();
#include “Riostream.h”
#include “stdio.h”

gStyle->SetCanvasPreferGL(true);
gSystem->Load(“libGeom”);
TGeoManager *geom = new TGeoManager(“simple1”, “Simple geometry”);

TGeoMaterial *matVacuum = new TGeoMaterial(“Vacuum”, 0,0,0);
TGeoMaterial *matAl = new TGeoMaterial(“Al”, 26.98,13,2.7);

TGeoMedium *Vacuum = new TGeoMedium(“Vacuum”,1, matVacuum);
TGeoMedium *Al = new TGeoMedium(“Root Material”,2, matAl);

TGeoVolume *top = geom->MakeBox(“TOP”, Vacuum,2000.,2000.,1000.);
geom->SetTopVolume(top);
top->SetVisibility(kFALSE);

TGeoVolume *tub[10];

for (Int_t tnr=0; tnr<10; tnr++)
{
tub[tnr] = geom->MakeBox(“tub”, Al, 2, 2, 200);
top->AddNode(tub[tnr],tnr, new TGeoTranslation(6*tnr, 0, 0));
}

geom->CloseGeometry();
geom->SetVisLevel(3);
top->Draw(“ogl”);
}[/size]

Hi asim,
probably you forgot add libGeom in libs:[ul]g++ -c main.cxx -I$(root-config --incdir)
g++ -O main.o $(root-config --libs) -lGeom -o main.exe[/ul]Jan

hi jan.

thank you very much.
this was the problem!

asim.