|
[Sponsors] |
Solver linking error: undefined reference to`Foam::XxFvPatchField<double>::typeName |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 13, 2014, 00:03 |
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 |
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 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 Hopefully someone can shed some light on this question. Thanks! Regards, Lianhua Last edited by zhulianhua; August 13, 2014 at 03:18. |
|
August 13, 2014, 05:11 |
code piece seems lead to the error
|
#2 |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15 |
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 |
|
August 14, 2014, 00:17 |
|
#3 |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15 |
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. |
|
July 15, 2018, 02:17 |
|
#4 |
New Member
Ruchit Patel
Join Date: May 2018
Location: Chennai
Posts: 24
Rep Power: 8 |
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
|
|
July 15, 2018, 02:32 |
|
#5 |
New Member
Ruchit Patel
Join Date: May 2018
Location: Chennai
Posts: 24
Rep Power: 8 |
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.
|
|
November 21, 2018, 22:02 |
|
#6 | |
Member
Join Date: Oct 2013
Posts: 92
Rep Power: 13 |
Quote:
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. |
||
March 22, 2019, 01:03 |
|
#7 |
Member
Join Date: Oct 2013
Posts: 92
Rep Power: 13 |
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 |
|
|
|
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 |