Linking error in OF-1.6-ext: undefined reference to ...
Dear Foamers,
I am trying to port a custom solver to OpenFOAM-1.6-ext. The compile process runs smoothly until a linking error is issued at the end of the process. The error is: Code:
-lfiniteVolume -lOpenFOAM -ltriSurface -lmeshTools -lmaterialConstitutiveModel -L/home/hisham/OpenFOAM/hisham-1.6-ext/lib/linux64GccDPOpt -lsoilZones -lcontactModel -pipe -lOpenFOAM -liberty -ldl -lm -o /home/hisham/OpenFOAM/hisham-1.6-ext/applications/bin/linux64GccDPOpt/geotechFoam3 Code:
IOField<scalarField> matHistoryScalar( Code:
EXE_LIBS = -lfiniteVolume \ Best regards Hisham |
Hi Hisham,
I do not think you are allowed to create an IOField< Field<Type> > in OpenFoam - at least I could not get it compiled either. Is this what you want, or do you merely need an IOField<Type>? All the best, Niels |
Hi again,
I could not help trying to get something like you sketched to compile, so along your line of thought, this might be, what you need: Code:
PtrList<IOField<vector> > listField(sZones.size()); Good luck, Niels |
Quote:
Hi Niels Thanks a lot for the super fast response. Actually, this code compiles and works perfectly on OpenFOAM-2.1.x. I do not know what could be the problem as the implementation of IOFields seems to be the same for both editions and I can't figure out more info from the linker message. The idea is to have a scalar(vector/symmTensor)Field for each zone that differs in size and they all write to one file (e.g. matHistoryScalar) in the time step. This how a file looks from a run on OF-2.1.x. Code:
/*--------------------------------*- C++ -*----------------------------------*\ Is there a more similar approach to what I need? Hisham |
I think I found where the problem might be. There are files in OF that are not in OF-ext:
scalarFieldIOField.H & .C vectorFieldIOField.H & .C symmTensorFieldIOField.H & .C I'll try to copy them to the solver directory. EDIT: No they're not. They are just typedefs: Quote:
|
You might be missing a defineTypeNameAndDebug macro in your .C file somewhere. Those are static class variables wrapped in macros.
Since you're dealing with a compound type, something like this might be necessary: // Explicitly specify typeNames for IOFields defineCompoundTypeName(Field<scalar>, scalarField); addCompoundToRunTimeSelectionTable(Field<scalar>, scalarField); defineCompoundTypeName(Field<vector>, vectorField); addCompoundToRunTimeSelectionTable(Field<vector>, vectorField); defineTemplateTypeNameAndDebugWithName ( IOList<scalarField>, "scalarFieldList", 0 ); defineTemplateTypeNameAndDebugWithName ( IOList<vectorField>, "vectorFieldList", 0 ); |
Quote:
Thanks a lot Sandeep. This surely makes it work :) Code:
namespace Foam Thanks again to both of you! Best regards, Hisham |
Dear Hisham and Sandeep,
I just found myself needed this solution, so thank you a lot for these posts. It was exceptionally helpful. Kind regards, Niels |
All times are GMT -4. The time now is 09:13. |