ACLIC, dynamic loading and static members

Hi,

I am experiencing issues with ROOT 6.05.02 when I try to load a class with static members and methods in a macro, getting errors like the one below:

Info in <TUnixSystem::ACLiC>: creating shared library /mnt_pool/fanae105/user/iglez/PROOF/WZHeppy/plotter/classA_C.so
IncrementalExecutor::executeFunction: symbol '_ZN6classA3fooE' unresolved while linking [cling interface function]!
You are probably missing the definition of classA::foo
Maybe you need to load the corresponding shared library?

It can be easily reproduced with the following three files:
classA.h

#pragma once

class classA {
 public:
  static void setFoo(int f) {foo =f;}
  static int  getFoo() {return foo;}
 protected:
  static int foo;
};

classA.C

#include "classA.h"

teststatic.C

// Load classA in ROOT 6
R__LOAD_LIBRARY(classA.C+)
#include "classA.h"

void teststatic() {
  classA* a = new classA();
  classA::setFoo(1);
}

Any idea on how to avoid these kind of issues? Thaks a lot,

Isidro

In your “classA.C”, add:
int classA::foo; // static member allocation

That did the trick. Dumb me!