EveManager segfault

I want to use Eve in my C++ project. In the Eve tutorial there is an example, geom_alice_tpc.C, which works if interpreted in Root. However, if I embed it in my C++ program, it segfaults.

Is it possible to use Eve in the C++ code? If so, what is the correct way to do it?

An example, using the code from geom_alice_tpc.C, that segfaults:

#include “TEveManager.h”
#include “TEveGeoNode.h”

int main(){
TEveManager::Create();
gGeoManager = gEve->GetGeometry(“http://root.cern.ch/files/alice.root”);

TGeoNode* node = gGeoManager->GetTopVolume()->FindNode(“TPC_M_1”);
TEveGeoTopNode* tpc = new TEveGeoTopNode(gGeoManager, node);
gEve->AddGlobalElement(tpc);

gEve->Redraw3D(kTRUE);

return 0;

}

Hi,

I modified your example to include the root event loop which was missing.
Eve does not implement its own … it requires ROOT’s TApplication or TRint to process the GUI events.

The compile command (for linux) is included as a comment in the attached file.

Best,
Matevz
foo.C (622 Bytes)

Yep, that worked. Thanks!