Compilation and namcespace

Dear all,

please find in attachement a set of files that produces an error that I can’t seem to solve.
To run into troubles, run: .L Package.C+, you should get the following output:

Info in TUnixSystem::ACLiC: creating shared library /home/greder/Downloads/./
In file included from /home/greder/Downloads/./B.C:1,
from /home/greder/Downloads/./Package.C:2,
from /home/greder/Downloads/./Package_C_ACLiC_dict.h:33,
from /home/greder/Downloads/./Package_C_ACLiC_dict.cxx:16:
/home/greder/Downloads/./A.h:5: error: redefinition of ‘class mynamespace::Test’
/home/greder/Downloads/./A.h:6: error: previous definition of ‘class mynamespace::Test’
g++: /home/greder/Downloads/./Package_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!

could you let me know what I am doing wrong ?

example_root.tgz (417 Bytes)


Make sure your class gets defined only once, e.g. by adding something like “#ifndef A_h_included” as show below:

[code]#ifndef A_h_included
#define A_h_included

#include “TNamed.h”

namespace mynamespace {

class Test : public TNamed

Test() : TNamed("","") {}
~Test() {}




Cheers, Bertrand.

indeed, as obvious as this … ! It works now.

Thank you for such a prompt reply,

You’re welcome :slight_smile:

Cheers, Bertrand.