CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Why is the wrong function called during run-time?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2021, 06:14
Default Why is the wrong function called during run-time?
  #1
Member
 
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5
lumpor is on a distinguished road
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
lumpor is offline   Reply With Quote

Old   May 26, 2021, 07:57
Default
  #2
Member
 
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5
lumpor is on a distinguished road
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.
lumpor is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 07:28.