|
[Sponsors] |
April 25, 2005, 06:02 |
Hello,
I would like write m
|
#1 |
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
Hello,
I would like write my own class to extend icoFoam. The class is defined in deflection.H and deflection.C, which are in the same directory as the solver. I included deflection.C in Make/files. That works fines and everything compiles as long as I dont want to call any member functions of that class. If i call one of them it returns > In function 'main': > :undefined reference to 'main::deflection::test()' I assume, I need to inclucde some command in Make/options, but I couldn't figure out which one. thank you Markus |
|
April 25, 2005, 06:17 |
Hi again,
reading the forum
|
#2 |
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
Hi again,
reading the forum helps. See the "namespace" thread. I was putting the #include "deflection.H" into the main function, which i shouldn't do apparently, dunno why, though. Sorry for this self-conversation Markus |
|
April 25, 2005, 06:25 |
deflection.H contains declarat
|
#3 |
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 22 |
deflection.H contains declarations and deflection.C contains definitions which you compile outside the scope of main. Then you wish to use the classes/functions from within main but you need to tell the compiler that they are declared in a different scope which is done my including deflection.H in the file containing the main function but not inside the main function because that would change the scope of the classes/functions and hence give you the linkage error you had before.
|
|
April 25, 2005, 06:36 |
thank you, i didn't think abou
|
#4 |
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
thank you, i didn't think about the scope
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
linking several faces | Christian F. | FLUENT | 1 | June 6, 2008 06:29 |
How to access solver fields from fvPatchField%2360Type derived class that defines BC | kar | OpenFOAM Running, Solving & CFD | 0 | February 29, 2008 12:41 |
Problem for linking | hsing | OpenFOAM Running, Solving & CFD | 2 | April 19, 2006 04:07 |
Linking fortran and c | vasanth | Main CFD Forum | 3 | January 29, 2005 12:38 |
linking the script | Mavinakere | FLUENT | 0 | September 12, 2002 11:57 |