|
[Sponsors] |
Warning:no return statement in function returning non-void [-Wreturn-type] |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Join Date: May 2020
Posts: 8
Rep Power: 5 ![]() |
Hi, everyone,
I'm compiling a new lib in Of-4.1. I met a warning"no return statement in function returning non-void [-Wreturn-type]" when compiling. The warning occurred in my code file "imcompressibleTurbuleneModel.H" line 140. The code is: #ifndef incompressibleTurbulenceModel_H #define incompressibleTurbulenceModel_H #include "turbulenceModel.H" #include "geometricOneField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // Forward declarations class fvMesh; /*---------------------------------------------------------------------------*\ Class incompressibleTurbulenceModel Declaration \*---------------------------------------------------------------------------*/ class incompressibleTurbulenceModel : public turbulenceModel { protected: // Protected data geometricOneField rho_; // Protected member functions //- ***HGW Temporary function to be removed when the run-time selectable // thermal transport layer is complete virtual void correctNut() {} private: // Private Member Functions //- Disallow default bitwise copy construct incompressibleTurbulenceModel(const incompressibleTurbulenceModel&); //- Disallow default bitwise assignment void operator=(const incompressibleTurbulenceModel&); public: //- Runtime type information TypeName("incompressibleTurbulenceModel"); // Constructors //- Construct from components incompressibleTurbulenceModel ( const geometricOneField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, const word& propertiesName ); //- Destructor virtual ~incompressibleTurbulenceModel() {} // Member Functions //- Return the laminar dynamic viscosity virtual tmp<volScalarField> mu() const; //- Return the laminar dynamic viscosity on patch virtual tmp<scalarField> mu(const label patchi) const; //- Return the turbulence dynamic viscosity virtual tmp<volScalarField> mut() const; //- Return the turbulence dynamic viscosity on patch virtual tmp<scalarField> mut(const label patchi) const; //- Return the effective dynamic viscosity virtual tmp<volScalarField> muEff() const; //- Return the effective dynamic viscosity on patch virtual tmp<scalarField> muEff(const label patchi) const; //- Return the effective stress tensor including the laminar stress virtual tmp<volSymmTensorField> devReff() const = 0; //- Return the source term for the momentum equation virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0; //- Return the source term for the momentum equation using NN surrogate virtual tmp<fvVectorMatrix> divDevReff ( volVectorField& U, volTensorField& S, volTensorField& R ) { } //line 140 }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif Could anyone tell me how to resolve this warning? Many thanks! |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 4 ![]() |
The { } at line 140 is the function body, which is empty. The file is a header file, which means it usually only has function declarations and not function implementations (except for some trivial functions like get functions).
The functions expects the body to include a "return x" line, where x is of type virtual tmp<fvVectorMatrix>. Since the function body is empty, nothing is returned. Most likely it's supposed to be a function declaration and not a function implementation. Replacing {} with ; should work. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] Errors during blockMesh meshing | Madeleine P. Vincent | OpenFOAM Meshing & Mesh Conversion | 51 | May 30, 2016 10:51 |
Creating a new field from terms of the turbulence model | HaZe | OpenFOAM Programming & Development | 15 | November 24, 2014 13:51 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 11:48 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 06:27 |
REAL GAS UDF | brian | FLUENT | 6 | September 11, 2006 08:23 |