Yes, eim_classes.h, rb_classes.h, and assembly.h all start and end with something like
#ifndef __eim_classes_h__ #define __eim_classes_h__ ... #endif There are no other .h files... On 10/31/14 4:51 PM, John Peterson wrote: > On Fri, Oct 31, 2014 at 9:03 AM, Lorenzo Zanon > <[email protected]> wrote: >> Hello, >> >> Referring to the RB examples, it would be great if I could use a >> separate source file in addition to the header rb_classes.h, but I'm >> getting a compile error, probably due to wrong local inclusions... >> >> That's how I do my inclusions: >> >> main file: reduced_basis_ex4.C >> #include "eim_classes.h" >> #include "rb_classes.h" >> #include "assembly.h" >> ... >> >> header EIM: eim_classes.h >> #include "assembly.h" >> ... >> >> header RB: rb_classes.h >> #include "eim_classes.h" (some RB classes need the EIM classes) >> #include "assembly.h" >> ... >> >> new source file: rb_classes.C >> #include "eim_classes.h" >> #include "rb_classes.h" >> ... >> >> assembly.h >> >> The error I'm getting has the form: >> >> reduced_basis_ex4.x86_64-unknown-linux-gnu.opt.o: In function >> `SimpleEIMEvaluation::initialize_eim_theta_objects()': >> reduced_basis_ex4.C:(.text+0xfe50): multiple definition of >> `SimpleEIMEvaluation::initialize_eim_theta_objects()' >> rb_classes.x86_64-unknown-linux-gnu.opt.o:rb_classes.C:(.text+0xf790): >> first defined here >> >> for all the SimpleEIM and SimpleRB functions. How could I fix that? > > Make sure all the header files you're using (especially ones you've > created) have include guards at the top. > ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
