Issue with compiling code with TEveManager

Dear all,

I’m having a small issue when trying to compile a ROOT code containing TEveManager.

The code runs fine with “root test.C”, but due to the amount of data to process and plot, I’m trying to compile it with

g++ -o test test.C `root-config --cflags --libs`

and I get the following errors in regard to TEveManager even including the library in the code:

test.C:(.text+0xd8f): undefined reference to `TEveManager::Create(bool, char const*)'

The following is a minimally reproducible example:

#include <iostream>

#include "TF3.h"
#include "TKey.h"
#include "TMath.h"
#include "TFile.h"
#include "TGaxis.h"
#include "TGraph.h"
#include "TStyle.h"
#include "TString.h"
#include "TCanvas.h"
#include "TFolder.h"
#include "TGraph2D.h"
#include "TEveLine.h"
#include "TEvePlot3D.h"
#include "TGeoSphere.h"
#include "TEveViewer.h"
#include "TEveBrowser.h"
#include "TEveManager.h"
#include "TEveGeoShape.h"
#include "TEveCompound.h"
#include "TApplication.h"
#include "TGFileBrowser.h"
#include "TEveProjectionManager.h"

TGFileBrowser *gBrowser = 0;

void test(){

    auto gEve = TEveManager::Create();

    gEve->GetBrowser()->StartEmbedding(0);
    gBrowser = gEve->GetBrowser()->MakeFileBrowser();
    gEve->GetBrowser()->StopEmbedding("Invariants");

    auto sphere = new TEveGeoShape("sphere");
    sphere->SetShape(new TGeoSphere(0., 1));

    auto cmp = new TEveCompound;
    cmp->OpenCompound();

    cmp->AddElement(sphere);

    cmp->CloseCompound();

    gEve->AddElement(cmp);
    gEve->Redraw3D(kTRUE);
}

void StandaloneApplication(int argc, char** argv) {
  test();
}

int main(int argc, char** argv){
    TApplication app("ROOT Application", &argc, argv);
    StandaloneApplication(app.Argc(), app.Argv());
    app.Run();
    return 0;
}

I’m sure the issue comes from my somewhat limited knowledge of declaring objects in C++, but I’ve tried lots of options already before asking here.

I’ll appreciate if someone could help me fixing this one.

Many thanks in advance :slight_smile:

_ROOT Version: 6.30/04
_Platform: Conda, Debian GNU/Linux
_Compiler: GCC


Hello @lgi,

try compiling with `root-config --libs --cflags` -lEve -lGeom

Cheers
Monica

1 Like

Dear @mdessole,

Super thanks :slight_smile:

I knew there was something fundamental that I was missing. Now it works smoothly.

Best regards.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.