CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

regarding error undefined reference to ... in openfoam.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 1, 2021, 04:41
Smile regarding error undefined reference to ... in openfoam.
  #1
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 97
Rep Power: 5
saicharan662000@gmail.com is on a distinguished road
hello guys,
I am trying to develop my own solver using compressibleInterFoam. I modified the solver and compiled it. I got the following error.
undefined reference to `Foam::twoPhaseMixtureThermo::twoPhaseMixtureTherm o(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&)'
/usr/bin/ld.bfd: myCompressibleInterFoam.C.text.startup+0x2fcf): undefined reference to `Foam::twoPhaseMixtureThermo::twoPhaseMixtureTherm o(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&)'
collect2: error: ld returned 1 exit status




Can anyone help me with this?
Thanks in advance
saicharan662000@gmail.com is offline   Reply With Quote

Old   December 1, 2021, 13:12
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,763
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You made a call to something that doesn't exist in the namespace hierarchy (hence the undefined reference). The thingy you tried to call is printed there exactly for you.

No idea what you modified but it could be something as simple as forgetting to link the libraries for the function that you are trying to call. This could easily happen if you just copy some lines from another solver and forget to link them (the .so shared object).
LuckyTran is offline   Reply With Quote

Old   April 12, 2022, 05:13
Default
  #3
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 97
Rep Power: 5
saicharan662000@gmail.com is on a distinguished road
Hello lucky,
I declared a variable mDot as a member Function in twoPhaseMixtureThermo.H . Later I used it in twoPhaseMixtureThermo.C and later used it in PEqn.H. I compiled the twoPhaseMixtureThermo library. It has no error. But when I compiled the solver I got the above error.


My options folder is like this.
EXE_INC = \
-I. \
-ItwoPhaseMixtureThermo/lnInclude \
-IVoFphaseCompressibleMomentumTransportModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-ltwoPhaseMixtureThermo \
-ltwoPhaseSurfaceTension \
-lfluidThermophysicalModels \
-lspecie \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lmomentumTransportModels \
-lfluidThermoMomentumTransportModels \
-lVoFphaseCompressibleMomentumTransportModels \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-ldynamicMesh \
-ldynamicFvMesh


twoPhaseMixtureThermo is already in solver so I think there is no Need to link it again. I just modified it to calculate mDot
saicharan662000@gmail.com is offline   Reply With Quote

Old   December 8, 2023, 07:02
Default
  #4
New Member
 
Roshan Shanmughan
Join Date: Jun 2017
Posts: 3
Rep Power: 9
roshan6890 is on a distinguished road
Hi Saicharan,
Did you manage to resolve your problem? If yes, could you please share how you did it?
roshan6890 is offline   Reply With Quote

Old   December 11, 2023, 03:02
Default
  #5
New Member
 
lisa purnellsw
Join Date: Dec 2023
Posts: 1
Rep Power: 0
lisapurnellsw is on a distinguished road
Quote:
Originally Posted by saicharan662000@gmail.com View Post
Hello lucky,
I declared a variable mDot as a member Function in twoPhaseMixtureThermo.H . Later I used it in twoPhaseMixtureThermo.C and later used it in PEqn.H. I compiled the twoPhaseMixtureThermo library. It has no error. But when I compiled the solver I got the above error.


My options folder is like this.
EXE_INC = \
-I. \
-ItwoPhaseMixtureThermo/lnInclude \
-IVoFphaseCompressibleMomentumTransportModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \2048
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-ltwoPhaseMixtureThermo \
-ltwoPhaseSurfaceTension \
-lfluidThermophysicalModels \
-lspecie \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lmomentumTransportModels \
-lfluidThermoMomentumTransportModels \
-lVoFphaseCompressibleMomentumTransportModels \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-ldynamicMesh \
-ldynamicFvMesh


twoPhaseMixtureThermo is already in solver so I think there is no Need to link it again. I just modified it to calculate mDot
The error you're encountering, "undefined reference," typically indicates that the linker is unable to find the implementation of a particular function or method. In this case, it's pointing to an undefined reference for twoPhaseMixtureThermo from the twoPhaseMixtureThermo class in the Foam namespace.
lisapurnellsw is offline   Reply With Quote

Reply

Tags
openfaom-8, openfoam


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
[OpenFOAM.org] Not found many .so files when installing OpenFOAM 6 lengjun OpenFOAM Installation 2 December 12, 2022 23:08
[OpenFOAM.com] An Error in recompiling of openFoam-4.0 alimea OpenFOAM Installation 4 April 8, 2020 15:44
[OpenFOAM.org] OpenFoam 3 on centOS Karakal OpenFOAM Installation 4 July 27, 2016 10:15
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 07:55
Compiling new Solver with wmake lin123 OpenFOAM 3 April 13, 2010 15:18


All times are GMT -4. The time now is 00:19.