|
[Sponsors] |
Why is the wrong function called during run-time? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 26, 2021, 06:14 |
Why is the wrong function called during run-time?
|
#1 |
Member
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5 |
I have a very strange problem.
I have a class A with a virtual function X(). Class B is derived from class A, and has X() overwritten. It compiles fine, but when calling X() from an instance of class B, I instead get a call to a completely different function in A (which isn't implemented and therefore gives an error). Even when I change the non-implemented function so that it prints something when called, nothing gets printed, which leads me to believe that it's not using the actual source files I'm changing, but rather an old version of the file instead. A google search said that it seems to be a problem regarding the compiler getting different headers mixed up. I thought about asking this question in a c++ forum but thought that the problem might have to do with the openFoam library structure so asked here instead. Has anyone experienced a similar problem? The class in question is thermoPhysicalModels/specie/reaction/Reactions/reaction.C. I made my a new virtual function for it, with override functions in IrreversibleReaction, ReversibleReaction and NonEquilibriumReversibleReaction, but instead of those functions being called, grhs() in reaction.C gets called. Any help wold be appreciated |
|
May 26, 2021, 07:57 |
|
#2 |
Member
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5 |
Found the answer. I needed to properly (using wclean) recompile every library used by the solver that was dependent on the library in question.
Last edited by lumpor; May 26, 2021 at 11:30. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
bash script for pseudo-parallel usage of reconstructPar | kwardle | OpenFOAM Post-Processing | 41 | August 23, 2023 02:48 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 02:50 |
dynamic Mesh is faster than MRF???? | sharonyue | OpenFOAM Running, Solving & CFD | 14 | August 26, 2013 07:47 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 06:42 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 14:11 |