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

Solver linking error: undefined reference to`Foam::XxFvPatchField<double>::typeName

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2014, 00:03
Default Solver linking error: undefined reference to`Foam::XxFvPatchField<double>::typeName
  #1
Member
 
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15
zhulianhua is on a distinguished road
Hi, Dear FOAMers !

I encountered a problem when compiling my new solver.
For this solver, I implemented a library libdugksFoam.so contains a numerical model fvDVM and several new B.C.s .

The compilation of the the library is OK.
But when the solver dugksFoam link to the library, there is an error saying :
Code:
undefined reference to`Foam::calculatedMaxwellFvPatchField<double>::typeName'.
The calculatedMaxwellFvPatchField is one of the new BC in the libarary.

The detailed compilation output is :


Code:
+ wmake libso BCs
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFields.C
Making dependency list for source file maxwellWallFvsPatchField/maxwellWallFvsPatchFields.C
Making dependency list for source file mixedFvsPatchField/mixedFvsPatchFields.C
SOURCE=calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calculatedMaxwellFvPatchFields.o
SOURCE=maxwellWallFvsPatchField/maxwellWallFvsPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/maxwellWallFvsPatchFields.o
SOURCE=mixedFvsPatchField/mixedFvsPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mixedFvsPatchFields.o
'/home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/lib/libdugksFoam.so' is up to date.
+ wmake libso fvDVM
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file discreteVelocity/discreteVelocity.C
Making dependency list for source file fvDVM/fvDVM.C
SOURCE=discreteVelocity/discreteVelocity.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFoam/lnInclude -IdiscreteVelocity/lnInclude -IfvDVM/lnInclude -I../BCs/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/discreteVelocity.o
SOURCE=fvDVM/fvDVM.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFoam/lnInclude -IdiscreteVelocity/lnInclude -IfvDVM/lnInclude -I../BCs/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fvDVM.o
'/home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/lib/libdugksFoam.so' is up to date.
+ wmake
Making dependency list for source file dugksFoam.C
SOURCE=dugksFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -IBCs/lnInclude -IfvDVM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/dynamicMesh/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/meshTools/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/dugksFoam.o
/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude/readTimeControls.H: In function ‘int main(int, char**)’:
/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude/readTimeControls.H:32: warning: unused variable ‘adjustTimeStep’
/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude/readTimeControls.H:35: warning: unused variable ‘maxCo’
/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude/readTimeControls.H:38: warning: unused variable ‘maxDeltaT’
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -IBCs/lnInclude -IfvDVM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/finiteVolume/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/dynamicMesh/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/meshTools/lnInclude -IlnInclude -I. -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPOpt/dugksFoam.o -L/home/lhzhu/centFOAM/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib \
             -L/home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/lib -lfiniteVolume -ldugksFoam -lmeshTools -lOpenFOAM -ldl   -lm -o /home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/bin/dugksFoam
/home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/lib/libdugksFoam.so: undefined reference to `Foam::calculatedMaxwellFvPatchField<double>::typeName'
collect2: ld returned 1 exit status
make: *** [/home/lhzhu/centFOAM/OpenFOAM/lhzhu-2.2.x/platforms/linux64GccDPOpt/bin/dugksFoam] Error 1
BTW, my OF version is 2.2.x .

Hopefully someone can shed some light on this question. Thanks!

Regards,

Lianhua

Last edited by zhulianhua; August 13, 2014 at 03:18.
zhulianhua is offline   Reply With Quote

Old   August 13, 2014, 05:11
Default code piece seems lead to the error
  #2
Member
 
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15
zhulianhua is on a distinguished road
I found it was the following code piece in the the discreteVelocity.C caused the problem.

But I still don't know why.

The new calculatedMaxwellFvPatchField is copied and changed from the fixedGradientFvPatchField.
I just changed the gradient_ member to the outGoing_ member.

Code:
516         {
517             calculatedMaxwellFvPatchField<scalar>& rhoPatch =
518                 refCast<calculatedMaxwellFvPatchField<scalar> >
519                 (dvm_.rhoVol().boundaryField()[patchi]);
520
521             forAll(gSurfPatch, facei)
522             {
523                 vector faceSf= SfPatch[facei];
524                 if ((xii & faceSf) >  0 ) // outgoing
525                 {
526                     gSurfPatch[facei] = iGbarPvol[faceCells[facei]]
527                         + ((iGbarPgrad[faceCells[facei]])
528                         & (CfPatch[facei] - C[faceCells[facei]] - xii*dt));
529                     hSurfPatch[facei] = iHbarPvol[faceCells[facei]]
530                         + ((iHbarPgrad[faceCells[facei]])
531                         & (CfPatch[facei] - C[faceCells[facei]] - xii*dt));
532                     rhoPatch.outGoing()[facei] //add to outGoing container
533                         += weight_ * (xii & faceSf) * gSurfPatch[facei];
534                 }
535             }
536         }

Hope this information will help you guys to figure out what's going wrong.


Regards,

Lianhua
zhulianhua is offline   Reply With Quote

Old   August 14, 2014, 00:17
Default
  #3
Member
 
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15
zhulianhua is on a distinguished road
Hah! Finally, I figured out what's going wrong.


It's because I first compiled the new boundary conditions BCs into the library libdugksFoam,
then compile the fvDVM into the same library libdugksFoam,
but the fvDVM uses the definitions in BCs.

I solved the problem by compiled the BCs into a anther library libdugksFoamBC,
and let fvDVM uses this library and compiled into libdugksFoam.
At last, let my new solver use these two libraries.

Lianhua

Last edited by zhulianhua; August 14, 2014 at 02:00.
zhulianhua is offline   Reply With Quote

Old   July 15, 2018, 02:17
Default
  #4
New Member
 
Ruchit Patel
Join Date: May 2018
Location: Chennai
Posts: 24
Rep Power: 8
ruchit@15847 is on a distinguished road
Hey...How did u solve this error ?? I am strucking to the similar kind of error....Please see followiing image....Screenshot from 2018-07-15 10:44:47.jpg
ruchit@15847 is offline   Reply With Quote

Old   July 15, 2018, 02:32
Default
  #5
New Member
 
Ruchit Patel
Join Date: May 2018
Location: Chennai
Posts: 24
Rep Power: 8
ruchit@15847 is on a distinguished road
Yaaah....Finally got it whats wrong going on !!! Actually I modified options file partially. So that's the problem. So I modified it completely and it compile correctly.
ruchit@15847 is offline   Reply With Quote

Old   November 21, 2018, 22:02
Default
  #6
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 13
fedvasu is on a distinguished road
Quote:
Originally Posted by ruchit@15847 View Post
Yaaah....Finally got it whats wrong going on !!! Actually I modified options file partially. So that's the problem. So I modified it completely and it compile correctly.
I too am facing this problem, what was the partial edit of options causing this?

I too faced a similar problem a year ago, I just can't figure out how I solved it. I am creating a new "type" in openfoam.
fedvasu is offline   Reply With Quote

Old   March 22, 2019, 01:03
Default
  #7
Member
 
Join Date: Oct 2013
Posts: 92
Rep Power: 13
fedvasu is on a distinguished road
this generally happens when your older links of functions and types are there in the old .so file,

better delete old .so files and recompile
fedvasu 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
OF211: ThirdParty and /src compiled, but not /applications... vkrastev OpenFOAM Installation 8 October 18, 2012 16:53
compile error about FJMPI chiven OpenFOAM Installation 11 March 31, 2010 07:27
Parallel processing problem with mpich nzy102 OpenFOAM Running, Solving & CFD 14 October 18, 2007 01:05
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 13:02
OpenFOAM with Cygwin kitchener OpenFOAM Installation 6 April 25, 2006 00:09


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