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

Can not resolve "undefined reference"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2016, 10:15
Default Can not resolve "undefined reference"
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   May 22, 2016, 23:30
Default
  #2
New Member
 
Jianzhi Li
Join Date: Jul 2013
Location: Shanghai, China
Posts: 27
Rep Power: 13
epi_c is on a distinguished road
Send a message via Skype™ to epi_c
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
epi_c is offline   Reply With Quote

Old   May 23, 2016, 03:38
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   May 23, 2016, 08:01
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
__________________
Keep foaming,
Tobias Holzmann
Tobi 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
Many "undefined reference" errors when linking to shared library cfbaptista OpenFOAM Programming & Development 8 April 15, 2016 06:58
[ICEM] ICEM - Need suggestions on how to resolve blocking problem NPGrad ANSYS Meshing & Geometry 6 January 5, 2015 15:53
Proper b.c. for kOmega model to resolve the boundary layers fumiya OpenFOAM 0 April 5, 2013 11:46
???how to resolve 'FLEXlm' error. plz help!??? rok FLUENT 1 September 28, 2007 14:29
how many points to resolve a boundary layer? Jiaying Xu Main CFD Forum 6 January 30, 2003 12:04


All times are GMT -4. The time now is 16:22.