CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Can not resolve "undefined reference" (https://www.cfd-online.com/Forums/openfoam-programming-development/172001-can-not-resolve-undefined-reference.html)

Tobi May 22, 2016 09:15

Can not resolve "undefined reference"
 
Hey all,

I am building my own mixed bc. I started my BC on a fixedGradient BC (turbulentHeatFluxTemperature) but the problem is that I need to call the updateCoeffs from the mixedFvPatchField:

Code:

    mixedFvPatchScalarField::updateCoeffs();
instead of the fixedGradient:

Code:

    fixedGradientFvPatchScalarField::updateCoeffs();
Doing this, I changed the derivation from
Code:

    public fixedGradientFvPatchScalarField
{

to

Code:

    public mixedFvPatchScalarField
{

And of course I changed all necessary stuff in the file. The problem that I have now is the undefined references of vtable during compilation:
Code:

shorty@myTemperatureLaplacianFoam: wmake
Making dependency list for source file myTemperatureLaplacianFoam.C
SOURCE=myTemperatureLaplacianFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/thermophysicalModels/radiationModels/lnInclude -IaserBC/lnInclude -IlnInclude -I. -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/myTemperatureLaplacianFoam.o
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/thermophysicalModels/radiationModels/lnInclude -IaserBC/lnInclude -IlnInclude -I. -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude  -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o Make/linux64GccDPOpt/myTemperatureLaplacianFoam.o -L/home/shorty/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib \
        -lfiniteVolume -lOpenFOAM -ldl  -lm -o /home/shorty/OpenFOAM/shorty-2.3.1/platforms/linux64GccDPOpt/bin/myTemperatureLaplacianFoam
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::laserMixedFvPatchScalarField::laserMixedFvPatchScalarField(Foam::laserMixedFvPatchScalarField const&, Foam::DimensionedField<double, Foam::volMesh> const&)':
laserMixedFvPatchScalarField.C:(.text+0x67e): undefined reference to `vtable for Foam::laserMixedFvPatchScalarField'
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::laserMixedFvPatchScalarField::laserMixedFvPatchScalarField(Foam::laserMixedFvPatchScalarField const&)':
laserMixedFvPatchScalarField.C:(.text+0xb5f): undefined reference to `vtable for Foam::laserMixedFvPatchScalarField'
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::laserMixedFvPatchScalarField::laserMixedFvPatchScalarField(Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&)':
laserMixedFvPatchScalarField.C:(.text+0xde1): undefined reference to `vtable for Foam::laserMixedFvPatchScalarField'
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::laserMixedFvPatchScalarField::laserMixedFvPatchScalarField(Foam::laserMixedFvPatchScalarField const&, Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::fvPatchFieldMapper const&)':
laserMixedFvPatchScalarField.C:(.text+0x1761): undefined reference to `vtable for Foam::laserMixedFvPatchScalarField'
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::laserMixedFvPatchScalarField::laserMixedFvPatchScalarField(Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::dictionary const&)':
laserMixedFvPatchScalarField.C:(.text+0x1934): undefined reference to `vtable for Foam::laserMixedFvPatchScalarField'
Make/linux64GccDPOpt/laserMixedFvPatchScalarField.o: In function `Foam::fvPatchField<double>::addpatchMapperConstructorToTable<Foam::laserMixedFvPatchScalarField>::New(Foam::fvPatchField<double> const&, Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::fvPatchFieldMapper const&)':
laserMixedFvPatchScalarField.C:(.text._ZN4Foam12fvPatchFieldIdE32addpatchMapperConstructorToTableINS_28laserMixedFvPatchScalarFieldEE3NewERKS1_RKNS_7fvPatchERKNS_16DimensionedFieldIdNS_7volMeshEEERKNS_18fvPatchFieldMapperE[_ZN4Foam12fvPatchFieldIdE32addpatchMapperConstructorToTableINS_28laserMixedFvPatchScalarFieldEE3NewERKS1_RKNS_7fvPatchERKNS_16DimensionedFieldIdNS_7volMeshEEERKNS_18fvPatchFieldMapperE]+0x22): undefined reference to `typeinfo for Foam::laserMixedFvPatchScalarField'
collect2: error: ld returned 1 exit status

The BC is in my own solver and is compiled with the solver using wmake.
All hints are appreciated.

epi_c May 22, 2016 22:30

Hi Tobias,

I think you used mixedFvPatchField in a wrong way, because it is designed as a middle layer boundary condition hence can not be used directly (updateCoeffs() not implemented or rewritten, so there are 'vtable' in your error message).

If your own boundary condition inherit from mixedFvPatchField, you should write your own updateCoeffs() method using methods in mixedFvPatchField if necessary, like in inletOutlet, instead of calling:

mixedFvPatchScalarField::updateCoeffs();

but calling:

fvPatchScalarField::updateCoeffs();

is OK. Hope this helps.

BR

Tobi May 23, 2016 02:38

Hi,

thanks for the replay. I will check it out. I also will check bernhards bc groovy. I need the robin bc ... At the moment everything is in groovybc and it works well but. I have a few new features that are a bit hard in groovy (already talked with bernhard).

Thanks again for the replay.

Tobi May 23, 2016 07:01

Hey,

okay now I debugged a bit more and (I am stupid),... inletOutlet is actually what I was searching for. I will give feedback if I am done.


All times are GMT -4. The time now is 13:55.