|
[Sponsors] |
February 5, 2021, 10:21 |
warning: [-Wunused-variable]
|
#1 |
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 9 |
Hi foamers,
I have a solver and I used it for quite a while. It retrieve data from a table and read it and use it (I am 100% sure as I did some validations against experimental data). However, there was always this warning of [-Wunused-variable] occurring at compilation for the variable A in createfields.H : Code:
tableParam tableObject("model",mesh); const volScalarField& A = tableObject.getData("A"); False warning: unused variable It seems that the problem is coming from initialization. I changed the second line of the code in different ways but it did not help. So, I would be grateful if you can help me with this issue. |
|
February 26, 2022, 12:14 |
|
#2 |
New Member
Andrew Bickerdike
Join Date: Feb 2021
Posts: 6
Rep Power: 5 |
Hi,
I'm having the same problem, have you since found a solution? |
|
February 26, 2022, 15:34 |
|
#3 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
If the code looks OK, just ignore the warning and get on with other things.
|
|
March 2, 2022, 06:58 |
|
#4 |
Member
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6 |
If you really want to get rid of it, just cast it to void.
Code:
tableParam tableObject("model",mesh); const volScalarField& A = tableObject.getData("A"); (void) A; |
|
Tags |
createfields.h, table data, [-wunused-variable] |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
foamToTecplot360 | thomasduerr | OpenFOAM Post-Processing | 121 | June 11, 2021 11:05 |
Caffa 3D code | Waliur Rahman | Main CFD Forum | 0 | May 29, 2018 01:53 |
[swak4Foam] installation problem with version 0.2.3 | Claudio87 | OpenFOAM Community Contributions | 9 | May 8, 2013 11:20 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 05:37 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |