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

non-virtual thunk and undefined reference to vtable

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 9, 2019, 17:26
Red face non-virtual thunk and undefined reference to vtable
  #1
Member
 
Rishikesh
Join Date: Apr 2016
Posts: 44
Rep Power: 5
mrishi is on a distinguished road
Hello all,

I am building a multi-region solver based on interFoam. I took the chtMultiRegionFoam solver structure and modified it, replacing the thermoFluid class with immiscibleIncompressibleTwoPhaseMixture, and corresponding scalar and vector fields (see attached createFluidFields.H).
When compiling, there seems to be some flaw in the way I have declared the immiscibleIncompressibleTwoPhaseMixture, which shows up as below:

Code:
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I../VoF -I./fluid -I./solid -I./interFlow -I./porousFluid -I./porousSolid -I./include -I./include/isoAdvection -I./include/isoCutCell -I./include/isoCutFace -ImultiphaseMixture/lnInclude -I/opt/openfoam6/src/meshTools/lnInclude -I/opt/openfoam6/src/sampling/lnInclude -I/opt/Attachment 72657openfoam6/src/finiteVolume/lnInclude -I/opt/openfoam6/src/finiteVolume/cfdTools -I/opt/openfoam6/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam6/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam6/src/thermophysicalModels/solidThermo/lnInclude -I/opt/openfoam6/src/ODE/lnInclude -I/opt/openfoam6/src/combustionModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/thermophysicalModels/radiation/lnInclude -I/opt/openfoam6/src/regionModels/regionModel/lnInclude -I/opt/openfoam6/src/transportModels -I/opt/openfoam6/src/transportModels/incompressible/lnInclude -I/opt/openfoam6/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam6/src/dynamicFvMesh/lnInclude -I/opt/openfoam6/src/lagrangian/basic/lnInclude -I/opt/openfoam6/src/lagrangian/intermediate/lnInclude -I/opt/openfoam6/src/lagrangian/turbulence/lnInclude -I/opt/openfoam6/src/regionModels/surfaceFilmModels/lnInclude  -IlnInclude -I. -I/opt/openfoam6/src/OpenFOAM/lnInclude -I/opt/openfoam6/src/OSspecific/POSIX/lnInclude   -fPIC -c fluid/compressibleCourantNo.C -o Make/linux64GccDPInt32Opt/fluid/compressibleCourantNo.o
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I../VoF -I./fluid -I./solid -I./interFlow -I./porousFluid -I./porousSolid -I./include -I./include/isoAdvection -I./include/isoCutCell -I./include/isoCutFace -ImultiphaseMixture/lnInclude -I/opt/openfoam6/src/meshTools/lnInclude -I/opt/openfoam6/src/sampling/lnInclude -I/opt/openfoam6/src/finiteVolume/lnInclude -I/opt/openfoam6/src/finiteVolume/cfdTools -I/opt/openfoam6/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam6/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam6/src/thermophysicalModels/solidThermo/lnInclude -I/opt/openfoam6/src/ODE/lnInclude -I/opt/openfoam6/src/combustionModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/thermophysicalModels/radiation/lnInclude -I/opt/openfoam6/src/regionModels/regionModel/lnInclude -I/opt/openfoam6/src/transportModels -I/opt/openfoam6/src/transportModels/incompressible/lnInclude -I/opt/openfoam6/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam6/src/dynamicFvMesh/lnInclude -I/opt/openfoam6/src/lagrangian/basic/lnInclude -I/opt/openfoam6/src/lagrangian/intermediate/lnInclude -I/opt/openfoam6/src/lagrangian/turbulence/lnInclude -I/opt/openfoam6/src/regionModels/surfaceFilmModels/lnInclude  -IlnInclude -I. -I/opt/openfoam6/src/OpenFOAM/lnInclude -I/opt/openfoam6/src/OSspecific/POSIX/lnInclude   -fPIC -c solid/solidRegionDiffNo.C -o Make/linux64GccDPInt32Opt/solid/solidRegionDiffNo.o
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I../VoF -I./fluid -I./solid -I./interFlow -I./porousFluid -I./porousSolid -I./include -I./include/isoAdvection -I./include/isoCutCell -I./include/isoCutFace -ImultiphaseMixture/lnInclude -I/opt/openfoam6/src/meshTools/lnInclude -I/opt/openfoam6/src/sampling/lnInclude -I/opt/openfoam6/src/finiteVolume/lnInclude -I/opt/openfoam6/src/finiteVolume/cfdTools -I/opt/openfoam6/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam6/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam6/src/thermophysicalModels/solidThermo/lnInclude -I/opt/openfoam6/src/ODE/lnInclude -I/opt/openfoam6/src/combustionModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/thermophysicalModels/radiation/lnInclude -I/opt/openfoam6/src/regionModels/regionModel/lnInclude -I/opt/openfoam6/src/transportModels -I/opt/openfoam6/src/transportModels/incompressible/lnInclude -I/opt/openfoam6/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam6/src/dynamicFvMesh/lnInclude -I/opt/openfoam6/src/lagrangian/basic/lnInclude -I/opt/openfoam6/src/lagrangian/intermediate/lnInclude -I/opt/openfoam6/src/lagrangian/turbulence/lnInclude -I/opt/openfoam6/src/regionModels/surfaceFilmModels/lnInclude  -IlnInclude -I. -I/opt/openfoam6/src/OpenFOAM/lnInclude -I/opt/openfoam6/src/OSspecific/POSIX/lnInclude   -fPIC -c multiFoam.C -o Make/linux64GccDPInt32Opt/multiFoam.o
In file included from multiFoam.C:119:0:
./fluid/setRegionFluidFields.H: In function 'int main(int, char**)':
./fluid/setRegionFluidFields.H:40:30: warning: unused variable 'g' [-Wunused-variable]
     const dimensionedVector& g = gFluid[i];
                              ^
./fluid/setRegionFluidFields.H:41:27: warning: unused variable 'gh' [-Wunused-variable]
     const volScalarField& gh = ghFluid[i];
                           ^~
./fluid/setRegionFluidFields.H:85:22: warning: unused variable 'pressureControl' [-Wunused-variable]
     pressureControl& pressureControl = pressureControlFluid[i];
                      ^~~~~~~~~~~~~~~
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I../VoF -I./fluid -I./solid -I./interFlow -I./porousFluid -I./porousSolid -I./include -I./include/isoAdvection -I./include/isoCutCell -I./include/isoCutFace -ImultiphaseMixture/lnInclude -I/opt/openfoam6/src/meshTools/lnInclude -I/opt/openfoam6/src/sampling/lnInclude -I/opt/openfoam6/src/finiteVolume/lnInclude -I/opt/openfoam6/src/finiteVolume/cfdTools -I/opt/openfoam6/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam6/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam6/src/thermophysicalModels/solidThermo/lnInclude -I/opt/openfoam6/src/ODE/lnInclude -I/opt/openfoam6/src/combustionModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/thermophysicalModels/radiation/lnInclude -I/opt/openfoam6/src/regionModels/regionModel/lnInclude -I/opt/openfoam6/src/transportModels -I/opt/openfoam6/src/transportModels/incompressible/lnInclude -I/opt/openfoam6/src/transportModels/twoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam6/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam6/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam6/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam6/src/dynamicFvMesh/lnInclude -I/opt/openfoam6/src/lagrangian/basic/lnInclude -I/opt/openfoam6/src/lagrangian/intermediate/lnInclude -I/opt/openfoam6/src/lagrangian/turbulence/lnInclude -I/opt/openfoam6/src/regionModels/surfaceFilmModels/lnInclude  -IlnInclude -I. -I/opt/openfoam6/src/OpenFOAM/lnInclude -I/opt/openfoam6/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/fluid/compressibleCourantNo.o Make/linux64GccDPInt32Opt/solid/solidRegionDiffNo.o Make/linux64GccDPInt32Opt/multiFoam.o -L/opt/openfoam6/platforms/linux64GccDPInt32Opt/lib \
    -L/home/openfoam/platforms/linux64GccDPInt32Opt/lib -llagrangian -lfluidThermophysicalModels -lspecie -lreactionThermophysicalModels -lsolidThermo -lODE -lturbulenceModels -lcompressibleTurbulenceModels -lincompressibleTurbulenceModels -lmeshTools -lfiniteVolume -lradiationModels -lfvOptions -lregionModels -lsampling -lincompressibleTransportModels -ltwoPhaseMixture -linterfaceProperties -ldynamicFvMesh -lOpenFOAM -ldl  \
     -lm -o /home/openfoam/platforms/linux64GccDPInt32Opt/bin/multiFoam
Make/linux64GccDPInt32Opt/multiFoam.o: In function `Foam::immiscibleIncompressibleTwoPhaseMixture::~immiscibleIncompressibleTwoPhaseMixture()':
multiFoam.C:(.text._ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD0Ev[_ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD5Ev]+0x3): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
Make/linux64GccDPInt32Opt/multiFoam.o: In function `non-virtual thunk to Foam::immiscibleIncompressibleTwoPhaseMixture::~immiscibleIncompressibleTwoPhaseMixture()':
multiFoam.C:(.text._ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD0Ev[_ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD5Ev]+0xaa): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
Make/linux64GccDPInt32Opt/multiFoam.o: In function `non-virtual thunk to Foam::immiscibleIncompressibleTwoPhaseMixture::~immiscibleIncompressibleTwoPhaseMixture()':
multiFoam.C:(.text._ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD0Ev[_ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD5Ev]+0x22a): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
Make/linux64GccDPInt32Opt/multiFoam.o: In function `Foam::PtrList<Foam::immiscibleIncompressibleTwoPhaseMixture>::~PtrList()':
multiFoam.C:(.text._ZN4Foam7PtrListINS_39immiscibleIncompressibleTwoPhaseMixtureEED2Ev[_ZN4Foam7PtrListINS_39immiscibleIncompressibleTwoPhaseMixtureEED5Ev]+0x44): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
Make/linux64GccDPInt32Opt/multiFoam.o: In function `non-virtual thunk to Foam::immiscibleIncompressibleTwoPhaseMixture::~immiscibleIncompressibleTwoPhaseMixture()':
multiFoam.C:(.text._ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD2Ev[_ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD5Ev]+0x13): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
Make/linux64GccDPInt32Opt/multiFoam.o:multiFoam.C:(.text._ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD2Ev[_ZN4Foam39immiscibleIncompressibleTwoPhaseMixtureD5Ev]+0x183): more undefined references to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture' follow
Make/linux64GccDPInt32Opt/multiFoam.o: In function `main':
multiFoam.C:(.text.startup+0x1de0): undefined reference to `Foam::immiscibleIncompressibleTwoPhaseMixture::immiscibleIncompressibleTwoPhaseMixture(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&)'
multiFoam.C:(.text.startup+0x1e14): undefined reference to `vtable for Foam::immiscibleIncompressibleTwoPhaseMixture'
multiFoam.C:(.text.startup+0x455f): undefined reference to `Foam::immiscibleIncompressibleTwoPhaseMixture::immiscibleIncompressibleTwoPhaseMixture(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&)'
/opt/openfoam6/platforms/linux64GccDPInt32Opt/lib/libinterfaceProperties.so: undefined reference to `typeinfo for Foam::alphaContactAngleFvPatchScalarField'
/opt/openfoam6/platforms/linux64GccDPInt32Opt/lib/libinterfaceProperties.so: undefined reference to `Foam::alphaContactAngleFvPatchScalarField::typeName'
collect2: error: ld returned 1 exit status
/opt/openfoam6/wmake/makefiles/general:140: recipe for target '/home/openfoam/platforms/linux64GccDPInt32Opt/bin/multiFoam' failed
make: *** [/home/openfoam/platforms/linux64GccDPInt32Opt/bin/multiFoam] Error 1
My declaration for the twoPhaseMixture (complete file is attached here - createFluidFields.H -
Code:
//PtrList<rhoReactionThermo> thermoFluid(fluidRegions.size()); //original chtMultiRegion fluid field

PtrList<immiscibleIncompressibleTwoPhaseMixture> mixtureFluid(fluidRegions.size());
To generate regionwise members of above list,

Code:
    Info<< " Adding to mixtureFluid\n" << endl;
    mixtureFluid.set
    (
        i,
        new immiscibleIncompressibleTwoPhaseMixture
        (
            UFluid[i],
            phiFluid[i]
           // fluidRegions[i]
        )
    );
this is based on the standard interFoam createFields for single region, which uses mixture(U,phi);

I would really appreciate if someone can help me figure out how to fix this issue.

I found two closest reported issues but I am not well-equipped to extrapolate my own issue from there:
1. Can not resolve "undefined reference"
2. Compile OF 2.3 on Mac OS X .... the patch

#2 was solved by modifying Make/options, adding -ltwoPhaseMixture and -linterfaceProperties to the EXE_LIBS list. However, this does not solve the issue in my case.

I much appreciate any direction regarding debugging this.
Attached Files
File Type: h createFields.H (377 Bytes, 0 views)
mrishi is offline   Reply With Quote

Old   October 16, 2019, 10:38
Default
  #2
Member
 
Rishikesh
Join Date: Apr 2016
Posts: 44
Rep Power: 5
mrishi is on a distinguished road
The error was in stupidity.!

I forgot to add -limmiscibleIncompressibleTwoPhaseMixture to Make/options.


Adding here just for documentation.
mrishi is offline   Reply With Quote

Reply

Tags
chtmultiregionfoam, compilation, multi region, multiphase

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sig Density Based Solver installation with FOAM Extend 3.2 qjh888 OpenFOAM Bugs 0 September 21, 2016 08:16
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43


All times are GMT -4. The time now is 09:27.