|
[Sponsors] |
'error: "variable" was not declared in this scope' |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 2, 2018, 16:43 |
'error: "variable" was not declared in this scope'
|
#1 |
New Member
Join Date: Sep 2016
Posts: 7
Rep Power: 9 |
Hello all,
I am new to and still learning OpenFOAM as well as C++. I am coming across an issue where when compiling it is telling me that my variables are not being declared. Even though they definitely are... well at least they seemingly are to me, based on other languages I've coded in. An example of this: Code:
#include "setRootCase.H" #include "createTime.H" #include "createMeshes.H" adjustTimeStep is declared in setRootCase.H. This issue can be resolved by taking everything in the header file and just pasting it in the main C file. Code:
const bool adjustTimeStep = runTime.controlDict().lookupOrDefault("adjustTimeStep", false); scalar maxCo = runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0); scalar maxDeltaT = runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT); #include "CourantNo.H" #include "setDeltaT.H" Is there something I am missing about programming in openFOAM or c++ where my variables are only declared temporarily but then forgotten? Any help is appreciated, as I have searched the forums and google but haven't found anything (maybe as to not using the right keywords as I'm not exactly sure what the issue is). |
|
July 3, 2018, 12:27 |
|
#2 |
New Member
Join Date: Sep 2016
Posts: 7
Rep Power: 9 |
I have found a similar issue with some additional information that may be related to mine.
https://www.linuxquestions.org/quest...enfoam-940604/ at this rate I think I can figure out what is going wrong as it seems like some sort of basic issue. Maybe not being declared in the correct scope. I will update after I solve the issue (hopefully at least) |
|
June 9, 2021, 21:35 |
|
#3 |
New Member
Robert Crane
Join Date: Jul 2020
Posts: 8
Rep Power: 5 |
Did you ever make any progress on this? Im struggling with a similar issue. In this case modifying chtMultiRegionSimpleFoam
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile calcMassFlowC | aurore | OpenFOAM Programming & Development | 13 | March 23, 2018 07:43 |
error compiling modified applications | yvyan | OpenFOAM Programming & Development | 21 | March 1, 2016 04:53 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 09:31 |
checking the system setup and Qt version | vivek070176 | OpenFOAM Installation | 22 | June 1, 2010 12:34 |
How to get the max value of the whole field | waynezw0618 | OpenFOAM Running, Solving & CFD | 4 | June 17, 2008 05:07 |