A strange behavior occurs when I try to create a shared library for a cpp (e.g. test.cpp) file (by typing .L test.cpp++ in ROOT interpreter). The header file (e.g. test.h) defines a nested class (A::B) with private access modifier. I got the following error
test_cc_ACLiC_dict.cxx: In function 'ROOT::TGenericClassInfo* ROOT::GenerateInitInstanceLocal(const A::B*)':
/afs/cern.ch/user/c/chlcheng/CodeBase/TRootProcessor/macros/test/src/test_cc_ACLiC_dict.cxx:103:67: error: 'class A::B' is private within this context
Here is the definition of the header and cpp file:
In test.h:
class A{
private:
class B{};
};
In test.cpp:
#include "test.h"
This error only occurs when the header file is placed in the same folder as the cpp file. If I put the header file to some other folder, no error will pop up. Is there any way to get around this? Thanks a lot.