← Back to team overview

dolfin team mailing list archive

Re: make demo

 

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/



Follow ups

References