|
[Sponsors] |
October 3, 2012, 07:56 |
symbol lookup error
|
#1 |
Senior Member
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 109
Rep Power: 17 |
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 = \ -lOpenFOAM \ -lmeshTools \ -lincompressibleTransportModels \ -lfiniteVolume What is missing? Thank you Robert |
|
October 4, 2012, 11:28 |
|
#2 |
Senior Member
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 109
Rep Power: 17 |
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 Thanks Robert |
|
October 4, 2012, 18:09 |
|
#3 |
Senior Member
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 109
Rep Power: 17 |
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: #ifdef NoRepository # include "gearDistData.C" #endif 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. Robert |
|
October 5, 2012, 08:00 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings Robert,
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...... Best regards, Bruno
__________________
|
|
October 5, 2012, 08:22 |
|
#5 |
Senior Member
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 109
Rep Power: 17 |
Hi, Bruno,
I apologize for the misunderstanding. Never in my mind to underestimate the reasons of the OF programmers to do thinks like they do . 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 . Unfortunately, I haven't seen it before. It could save me a lot of time... Best regard Robert |
|
October 5, 2012, 08:29 |
|
#6 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quote:
They're not object code unless they're actually used somewhere! And they can only be used if and when they're actually visible...
__________________
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Undeclared Identifier Errof UDF | SteveGoat | Fluent UDF and Scheme Programming | 7 | October 15, 2014 07:11 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 09:31 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 18:44 |
[Netgen] Installation of Netgen in SuSE Linux 92 | edvardsenpriv | OpenFOAM Meshing & Mesh Conversion | 23 | January 16, 2009 06:12 |
user defined function | cfduser | CFX | 0 | April 29, 2006 10:58 |