[Users] gcc-4.7 compile errors

Erik Schnetter schnetter at cct.lsu.edu
Wed Apr 4 12:07:44 CDT 2012


Vassilios

Thank you for pointing this out!

Since gcc 4.7 is relatively new, I recommend using the -fpermissive
flag until the next release. I have already a correction for this
problem, and will apply it to the development version soon.

-erik

On Wed, Apr 4, 2012 at 5:19 AM, Vassilios Mewes <vassilios.mewes at uv.es> wrote:
> Hello Dr. Schnetter,
>
> i tried to post the following below as a new ticket on the einstein toolkit
> trac webiste, but it gets rejected as potential spam everytime...its a about
> a compile error with the new gcc-4.7...
>
> the error disappears when using the -fpermissive flag, but i red that this
> is in general not advisable...
>
> best wishes,
>
> Vassili
>
>
> Hello!
>
> when i try to build the einstein toolkit (maxwell release) with the new
> gcc4.7 on a iMac running OS X Lion 10.7.3, there are build errors in the
> file ioascii.cc, which i think is related to the following changes in gcc:
> ''
> G++ now correctly implements the two-phase lookup rules such that an
> unqualified name used in a template must have an appropriate declaration
> found either in scope at the point of definition of the template or by
> argument-dependent lookup at the point of instantiation. As a result, code
> that relies on a second unqualified lookup at the point of instantiation to
> find functions declared after the template or in dependent bases will be
> rejected. The compiler will suggest ways to fix affected code, and using the
> -fpermissive compiler flag will allow the code to compile with a warning.
> template <class T>
> void f() { g(T()); } // error, g(int) not found by argument-dependent lookup
> void g(int) { } // fix by moving this declaration before the declaration of
> f
>
> template <class T>
> struct A: T {
>   // error, B::g(B) not found by argument-dependent lookup
>   void f() { g(T()); } // fix by using this->g or A::g
> };
>
> struct B { void g(B); };
>
> int main()
> {
>   f<int>();
>   A<B>().f();
> }''
>
> the following error messages are generated by gcc4.7 upon compiling:
>
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:
> In instantiation of ‘static void
> CarpetIOASCII::IOASCII<outdim>::OutputDirection(const cGH*, int,
> std::string, std::string, const vect<int, D>&, bool, bool) [with int outdim
> = 0; cGH = _cGH; std::string = std::basic_string<char>]’:
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1483:18:
>   required from here
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:642:15:
> error: ‘WriteASCII’ was not declared in this scope, and no declarations were
> found by argument-dependent lookup at the point of instantiation
> [-fpermissive]
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1271:8:
> note: ‘template<int outdim> void CarpetIOASCII::WriteASCII(std::ostream&,
> std::vector<gdata*>, const bbox<int, 3>&, int, int, const vect<int, 3>&,
> const vect<int, D>&, int, int, int, int, int, double, const vect<double,
> 3>&, const vect<double, 3>&)’ declared here, later in the translation unit
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:
> In instantiation of ‘static void
> CarpetIOASCII::IOASCII<outdim>::OutputDirection(const cGH*, int,
> std::string, std::string, const vect<int, D>&, bool, bool) [with int outdim
> = 1; cGH = _cGH; std::string = std::basic_string<char>]’:
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1484:18:
>   required from here
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:642:15:
> error: ‘WriteASCII’ was not declared in this scope, and no declarations were
> found by argument-dependent lookup at the point of instantiation
> [-fpermissive]
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1271:8:
> note: ‘template<int outdim> void CarpetIOASCII::WriteASCII(std::ostream&,
> std::vector<gdata*>, const bbox<int, 3>&, int, int, const vect<int, 3>&,
> const vect<int, D>&, int, int, int, int, int, double, const vect<double,
> 3>&, const vect<double, 3>&)’ declared here, later in the translation unit
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:
> In instantiation of ‘static void
> CarpetIOASCII::IOASCII<outdim>::OutputDirection(const cGH*, int,
> std::string, std::string, const vect<int, D>&, bool, bool) [with int outdim
> = 2; cGH = _cGH; std::string = std::basic_string<char>]’:
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1485:18:
>   required from here
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:642:15:
> error: ‘WriteASCII’ was not declared in this scope, and no declarations were
> found by argument-dependent lookup at the point of instantiation
> [-fpermissive]
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1271:8:
> note: ‘template<int outdim> void CarpetIOASCII::WriteASCII(std::ostream&,
> std::vector<gdata*>, const bbox<int, 3>&, int, int, const vect<int, 3>&,
> const vect<int, D>&, int, int, int, int, int, double, const vect<double,
> 3>&, const vect<double, 3>&)’ declared here, later in the translation unit
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:
> In instantiation of ‘static void
> CarpetIOASCII::IOASCII<outdim>::OutputDirection(const cGH*, int,
> std::string, std::string, const vect<int, D>&, bool, bool) [with int outdim
> = 3; cGH = _cGH; std::string = std::basic_string<char>]’:
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1486:18:
>   required from here
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:642:15:
> error: ‘WriteASCII’ was not declared in this scope, and no declarations were
> found by argument-dependent lookup at the point of instantiation
> [-fpermissive]
> /Users/vass/programs/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1271:8:
> note: ‘template<int outdim> void CarpetIOASCII::WriteASCII(std::ostream&,
> std::vector<gdata*>, const bbox<int, 3>&, int, int, const vect<int, 3>&,
> const vect<int, D>&, int, int, int, int, int, double, const vect<double,
> 3>&, const vect<double, 3>&)’ declared here, later in the translation unit
> make[3]: *** [ioascii.cc.o] Error 1
> make[2]: *** [make.checked] Error 2
> make[1]: ***
> [/Users/vass/programs/Cactus/configs/BHWinTest/lib/libthorn_CarpetIOASCII.a]
> Error 2
> make: *** [BHWinTest] Error 2



-- 
Erik Schnetter <schnetter at cct.lsu.edu>
http://www.perimeterinstitute.ca/personal/eschnetter/


More information about the Users mailing list