symbol lookup error
I have seen several threads with this same title, but I am still unable to solve my problem.
I have defined a new transport model and it compiles fine, but when I run the solver, it gives the following error:
undefined symbol: _ZN4Foam12gearDistDataINS_13wallPointDataINS_6Vect orIdEEEEEC2ERKNS_6fvMeshERNS_14GeometricFieldIS3_N S_12fvPatchFieldENS_7volMeshEEERKbRKNS_4ListINS_6w ordReEEE
(gearDistData is an small modification of wallDistData)
I think that there is some dependence with a library which has not been satisfied. How can I know what library? In the options file for the model I have put the libraries:
LIB_LIBS = \
What is missing?
I have some additional information.
I have modified the wallDistData in order to calculate the distance to a particular wall (given as argument). The wallDistData class uses a template type for transfer. I have conserved this (despite I will transfer only wallPointData, for the wallDistReflection function). But when I type "ld" for my library, it says:
undefined reference to `Foam::gearDistData<Foam::wallPointData<Foam::Vect or<double> > >::~gearDistData()'
undefined reference to `Foam::gearDistData<Foam::wallPointData<Foam::Vect or<double> > >::correct()'
undefined reference to `Foam::gearDistData<Foam::wallPointData<Foam::Vect or<double> > >::gearDistData(Foam::fvMesh const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&, bool const&, Foam::List<Foam::wordRe> const&)'
These functions are correctly defined in gearDataDist. But I don't know if this is an issue with the template class. Could I perhaps modify the gearDistData to use with just wallPointData?
Any comment will be welcome
I think I have found a workaround.
As I have seen in some C++ forums, when a class is defined with a template, the full implementation has to be declared in the header file (the reason of that, no idea...) Probably this is the reason of this text at the end of the wallDistData.H:
# include "gearDistData.C"
Initially I commented this text to avoid duplications of definitions. Now I have uncommented it, and commented the gearDistData.C in the Make/files file, and it seems to work. At least, it gives no undefined symbols...
Hope it will be useful for somebody.
Many thanks for sharing the steps of your endeavor!
I wrote some stuff about "NoRepository" sometime ago here: http://www.cfd-online.com/Forums/ope...epository.html
Last but not least: do not underestimate the coding reasoning behind OpenFOAM's code ;) If it was done in this way, there should always be a meaning to it... and sometimes "performance" is very likely the reason ;)
Which is why we sometimes get lost in the middle of its code......
I apologize for the misunderstanding. Never in my mind to underestimate the reasons of the OF programmers to do thinks like they do :o. I can understand the reason to include a NoRepository flag in order to explicitly have the coding in the header file. But I still don't understand (and I think that is it out of my scope) why a c++ template class has to be entirely defined in the header file.
Thank you for your link to the NoRepository thread :D. Unfortunately, I haven't seen it before. It could save me a lot of time...
They're not object code unless they're actually used somewhere! And they can only be used if and when they're actually visible... ;)
|All times are GMT -4. The time now is 23:42.|