← Back to team overview

dolfin team mailing list archive

Re: make demo

 

I found something about anonymous structure (class) name and anonymous class
type on this site:
http://msdn2.microsoft.com/en-us/library/z2cx9y4f.aspx. 

The same was said in Bjarne Stroustrup's book: The C++ Programming Language
(Third Edition and Special Edition)- pages 810 - 840.

I am not sure if it is a good idea when we have to avoid using an old gcc
instead of changing some small codes to get a clear and standard form. 

Anyone tryied to compile the new Dolfin by gcc 3.4? Someone said that new
anonymous properties have been added from gcc 4.

Dung.


Quoting Anders Logg <logg@xxxxxxxxx>:

> When I think of it, people may use other compilers than gcc, so I just
> added a note in the README file that version 3.4 or more recent may be
> needed when compiling with gcc.
> 
> I'll hold off with the new release until this afternoon (Chicago
> time) if I haven't heard any objections by then.
> 
> /Anders
> 
> 
> On Fri, Mar 24, 2006 at 08:17:28AM -0600, Anders Logg wrote:
> > ok, maybe we should put in a test in configure for a recent version of
> > gcc?
> > 
> > Anyone knows of a suitable macro to use in configure.in to check for
> > gcc >= 3.4?
> > 
> > /Anders
> > 
> > 
> > On Fri, Mar 24, 2006 at 02:53:39PM +0100, Garth N. Wells wrote:
> > > I can't give a definitive answer on whether or not anonymous classes are
> > > part of ISO C++, but it does seem that this is a gcc 3.3 bug which has
> > > been fixed in gcc >= 3.4 (http://gcc.gnu.org/gcc-3.4/changes.html).
> > > 
> > > I don't think that it's unreasonable that DOLFIN require gcc >= 3.4, so
> > > we can keeps things as they are.
> > > 
> > > Garth
> > > 
> > > 
> > > On Thu, 2006-03-23 at 13:46 -0600, Anders Logg wrote:
> > > > It depends on how old the compilers are that can't handle it...
> > > > 
> > > > But if it's not in the standard then we should avoid it. Do you know
> > > > if anonymous classes are allowed in ISO C++?
> > > > 
> > > > /Anders
> > > > 
> > > > 
> > > > On Thu, Mar 23, 2006 at 08:10:48PM +0100, Nguyen Tien Dung wrote:
> > > > 
> > > > > By changing to standard definitions like that, it works. Do you think
> we 
> > > > > should keep ISO forms when writing new versions, so that both old and
> new 
> > > > > compilers can be used?
> > > > > 
> > > > > 
> > > > > Quoting Anders Logg <logg@xxxxxxxxx>:
> > > > > 
> > > > > > My interpretation is that your gcc complains the about use of
> > > > > > anonymous classes:
> > > > > > 
> > > > > > Does it help if you change in the three places in
> > > > > > src/demo/pde/convection-diffusion/main.cpp where this is used?
> > > > > > 
> > > > > > Change from
> > > > > > 
> > > > > >     class : public Function
> > > > > >     {
> > > > > >         ...
> > > > > >     } f;
> > > > > > 
> > > > > > to
> > > > > > 
> > > > > >     class MyFunction : public Function
> > > > > >     {
> > > > > >         ...
> > > > > >     };
> > > > > > 
> > > > > >     MyFunction f;
> > > > > > 
> > > > > > and similarly for the two BoundaryConditions.
> > > > > > 
> > > > > > Does anyone know if 'class : public Foo { } foo;' is not allowed
> in
> > > > > > ANSI C++? I thought it was ok.
> > > > > > 
> > > > > > /Anders
> > > > > > 
> > > > > > On Thu, Mar 23, 2006 at 06:54:35PM +0100, Nguyen Tien Dung wrote:
> > > > > > > Dear all,
> > > > > > > 
> > > > > > > With gcc version 3.3.4, when I put the command: make demo from
> the
> > > > > > top-level
> > > > > > > directory of dolfin 0.6.0, I get the following errors:
> > > > > > > 
> > > > > > > 
> > > > > > > main.cpp: In function `void
> solveConvectionDiffusion(dolfin::Mesh&,
> > > > > > >    dolfin::Function&)':
> > > > > > > main.cpp:22: error: parse error before `:' token
> > > > > > > main.cpp: At global scope:
> > > > > > > main.cpp:31: error: ISO C++ forbids declaration of `bc' with no
> type
> > > > > > > main.cpp:34: error: parse error before `:' token
> > > > > > > main.cpp:40: error: ISO C++ forbids declaration of `f' with no
> type
> > > > > > > main.cpp:50: error: `mesh' was not declared in this scope
> > > > > > > main.cpp:53: error: `velocity' was not declared in this scope
> > > > > > > main.cpp:54: error: `velocity' was not declared in this scope
> > > > > > > main.cpp:57: error: `mesh' was not declared in this scope
> > > > > > > main.cpp:57: error: ISO C++ forbids declaration of `assemble'
> with no type
> > > > > > > main.cpp:57: error: `int dolfin::FEM::assemble' is not a static
> member of
> > > > > > `
> > > > > > >    class dolfin::FEM'
> > > > > > > main.cpp:57: error: initializer list being treated as compound
> expression
> > > > > > > main.cpp:69: error: parse error before `while'
> > > > > > > main.cpp:73: error: `mesh' was not declared in this scope
> > > > > > > main.cpp:73: error: ISO C++ forbids declaration of `applyBC' with
> no type
> > > > > > > main.cpp:73: error: `int dolfin::FEM::applyBC' is not a static
> member of
> > > > > > `class
> > > > > > >    dolfin::FEM'
> > > > > > > main.cpp:73: error: initializer list being treated as compound
> expression
> > > > > > > main.cpp:76: error: syntax error before `.' token
> > > > > > > main.cpp:79: error: syntax error before `<<' token
> > > > > > > main.cpp:82: error: ISO C++ forbids declaration of `p' with no
> type
> > > > > > > main.cpp:82: error: conflicting types for `int p'
> > > > > > > main.cpp:68: error: previous declaration as `dolfin::Progress p'
> > > > > > > main.cpp:85: error: syntax error before `+=' token
> > > > > > > main.cpp:86: error: ISO C++ forbids declaration of `U0' with no
> type
> > > > > > > main.cpp:86: error: conflicting types for `int U0'
> > > > > > > main.cpp:49: error: previous declaration as `dolfin::Function
> U0'
> > > > > > > main.cpp:87: error: parse error before `}' token
> > > > > > > main.cpp: In function `int main()':
> > > > > > > main.cpp:93: error: parse error before `:' token
> > > > > > > main.cpp:101: error: return-statement with no value, in function
> declared
> > > > > > with
> > > > > > >    a non-void return type
> > > > > > > main.cpp: At global scope:
> > > > > > > main.cpp:105: error: parse error before `if'
> > > > > > > main.cpp:118: error: ISO C++ forbids declaration of `bc' with no
> type
> > > > > > > main.cpp:118: error: redefinition of `int bc'
> > > > > > > main.cpp:31: error: `int bc' previously declared here
> > > > > > > main.cpp:122: error: conflicting types for `dolfin::Function f'
> > > > > > > main.cpp:40: error: previous declaration as `int f'
> > > > > > > main.cpp:123: error: conflicting types for
> `dolfin::Stokes::BilinearForm
> > > > > > a'
> > > > > > > main.cpp:53: error: previous declaration as `
> > > > > > >    dolfin::ConvectionDiffusion::BilinearForm a'
> > > > > > > main.cpp:124: error: conflicting types for
> `dolfin::Stokes::LinearForm L'
> > > > > > > main.cpp:54: error: previous declaration as `
> > > > > > >    dolfin::ConvectionDiffusion::LinearForm L'
> > > > > > > main.cpp:125: error: invalid conversion from `int' to
> `dolfin::PDE::Type'
> > > > > > > main.cpp:125: error:   initializing argument 4 of `
> > > > > > >    dolfin::PDE::PDE(dolfin::BilinearForm&, dolfin::LinearForm&,
> > > > > > dolfin::Mesh&,
> > > > > > >    dolfin::PDE::Type)'
> > > > > > > main.cpp:130: error: syntax error before `.' token
> > > > > > > main.cpp:135: error: syntax error before `<<' token
> > > > > > > main.cpp:136: error: syntax error before `<<' token
> > > > > > > main.cpp:139: error: ISO C++ forbids declaration of
> > > > > > `solveConvectionDiffusion'
> > > > > > >    with no type
> > > > > > > main.cpp:139: error: `int solveConvectionDiffusion' redeclared
> as
> > > > > > different
> > > > > > >    kind of symbol
> > > > > > > main.cpp:20: error: previous declaration of `void
> > > > > > >    solveConvectionDiffusion(dolfin::Mesh&, dolfin::Function&)'
> > > > > > > main.cpp:139: error: initializer list being treated as compound
> expression
> > > > > > > main.cpp:139: error: cannot convert `dolfin::Function' to `int'
> in
> > > > > > >    initialization
> > > > > > > main.cpp:140: error: parse error before `}' token
> > > > > > > main.cpp:124: confused by earlier errors, bailing out
> > > > > > > 
> > > > > > > 
> > > > > > > N.T.Dung
> > > > > > > 
> > > > > > 
> > > > > 
> > > > > 
> > > > 
> > 
> 
> -- 
> Anders Logg
> Research Assistant Professor
> Toyota Technological Institute at Chicago
> http://www.tti-c.org/logg/
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> 


-- 
Room 645, Section of Construction Mechanics.
Faculty of Civil Engineering and Geosciences (Citg).
Delft University of Technology (TuDelft).
Stevinweg1, P.O.Box 5048, 2600 GA Delft, the Netherlands.
Tel: +31(0).1527.85710.
Email: n.t.dung@xxxxxxxxxxxxxxx.



Follow ups

References