Error: Symbol MDSModuleDefaultSettings

ROOTers,

I want to document the following error I was able to figure out and I decided to do it through this posting. The error is caused by the use of typedef while defining structures.
I was trying to compile my c++ program using rootcint. However something didn’t work out in the generation of the dictionary. My class looked like this:

class vme_V1785 : public vme_SlaveModule
{
public:

typedef struct MDS{
unsigned int IRQline;
unsigned int IRQID;

};

typedef struct eventToken{
unsigned int ADCvalue[V1785_TOTAL_MAX_CHAN];
int ctrNotValid;
int geoAddress;
int crate;
int counterActiveADCs;
bool channelActive[V1785_TOTAL_MAX_CHAN];
bool underThreshold[V1785_TOTAL_MAX_CHAN];
bool overFlow[V1785_TOTAL_MAX_CHAN];
unsigned long eventCounter;

bool boolIsEmptyEvent;
bool boolIsGoodIntegrity;  //if event is formed of a  header-trailer set

};

///etc… OTHER MEMEBER VARIABLE/FUNCTION DEFINITIONS

);// END OF HEADER FILE

After trying to compile, I got the error attached at the end of this posting. I was able to solve the problem by removing the typedef declaration at the beginning of structure definitions. it was a very straight forward solution. What is peculiar about his case is that the struct eventToken was implemented way early in the class and the following declaration did not cause any error (rootcint did not care):

typedef struct eventToken{ …}

However as soon as I add the new structure definition:

typedef struct MDS{ …}

I start having the errors. It was not clear to me at first why rootcint was complaining since I had already a struct type defined in my class. It took me about 6 hours, after looking at so many postings to figure out that the problem was the reserve word “typedef” in my structure definitions.

I hope this help somebody in the feature.
Cheers,

Kris

ERROR OUTPUT

rootcint -f /export/home/workspace/vmeFiles/VME_OOP24f/src/APIanalyzerDict.cxx -c -p -I/export/home/workspace/vmeFiles/VME_OOP24f/include /export/home/workspace/vmeFiles/VME_OOP24f/include/APIanalyzer.h /export/home/workspace/vmeFiles/VME_OOP24f/include/vme_FileLoader.h /export/home/workspace/vmeFiles/VME_OOP24f/include/APIanalyzerLinkDef.h
Error: Symbol MDSModuleDefaultSettings is not defined in current scope /export/home/workspace/vmeFiles/VME_OOP24f/include/vme_V1290N.h:534:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing /export/home/workspace/vmeFiles/VME_OOP24f/src/APIanalyzerDict.cxx /export/home/workspace/vmeFiles/VME_OOP24f/src/APIanalyzerDict.h !!!
Error: rootcint: error loading headers…
make[1]: *** [APIanalyzer] Error 1
make: *** [aa] Error 2

Hi,

As a side note the code snippet shown above is illegal C++. Whenever there is a mysterious error in cint/rootcint, we recommend that you try compiling the input with g++ as a first step.

Cheers,
Philippe.

Could you please clarify what is illegal about the code?

How can I compile with g++ when I need to link against the generated dictionary?
I build all my objects with g++ and I didn’t have any errors or any warnings.
I was compiling with rootcint -c -p flags for the linking step.

Moreover in my initial program, I did implemente the calls

typedef struct some_structure {…}

and this was not illegal when I was compiling. The problem arose when I introduced the second structure definition. Having a proper way to define structure (or knowing the ways to avoid bad coding) will really save some headaches. Thanks for your comments about this…

Kris

[quote]Could you please clarify what is illegal about the code? [/quote]Well apparently nothing :slight_smile:. Indeed I forgot that the C++ sees 'typedef struct X {}; as a shortcut for ‘typedef struct X {} X;’. [So I assumed it was illegal due to the missing target of the typedef] Either way the typedef is not needed in C++. (i.e. whether you do ‘typedef struct X {}’ or just ‘struct X {}’ you can always refer to the type as simply ‘X’).

[quote]I build all my objects with g++ and I didn’t have any errors or any warnings. [/quote]That is what I meant.

Cheers,
Philippe.