|
[Sponsors] |
June 15, 2010, 04:51 |
problems with compiling self defined class
|
#1 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
Hi at all,
i tried to implement my own class(class Tracing) which follows the flameFront and writes the current position of the flame to a file. So i wrote two files: Tracing.H Tracing.C After including flameTrace.H in my solver and creating an Object of this class by ... Tracing flameTip; ... and using the two methods for following the flame and write the position to the file, by: flameTip.follow(); ... flameTip.write(); I allways get this error message while compiling the solver: Make/linux64GccDPOpt/reactingTotalFoamFE2.o: In function `main': reactingTotalFoamFE2.C.text+0x338f): undefined reference to `main::Tracing::Tracing()' reactingTotalFoamFE2.C.text+0x9bdf): undefined reference to `main::Tracing::~Tracing()' reactingTotalFoamFE2.C.text+0xa74b): undefined reference to `main::Tracing::follow()' reactingTotalFoamFE2.C.text+0xa79e): undefined reference to `main::Tracing::writeToFile()' reactingTotalFoamFE2.C.text+0xdb2a): undefined reference to `main::Tracing::~Tracing()' collect2: ld returned 1 exit status make: *** [/nfs/home/fleischer/OpenFOAM/fleischer-1.6.x/applications/bin/linux64GccDPOpt/reactingTotalFoamFE2] Error 1 I don't know what "undefined reference to main::Tracing::....." shoud mean!? Can anybody help me please! Thanks a lot in advance! Victor |
|
June 15, 2010, 05:19 |
|
#2 | |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
That seems odd. Have you changed Make/options and/or Make/files as well? Is this part of a library or are you compiling it with the solver?
And are you sure you meant flameTrace.H instead of Tracing.H: Quote:
__________________
Laurence R. McGlashan :: Website |
||
June 15, 2010, 06:02 |
|
#3 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
Thank you l_r_mcglashan, I think there are different problems but the basic one is that i didn't know that i need a make-folder for compiling the header file correctly.
I think i will try the whole thing in a easier way....but thanks a lot for your help! |
|
June 15, 2010, 06:07 |
|
#4 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Grabbing an example from the sources, have a look at the application heatTransfer/chtMultiRegionFoam. See how the regionProperties class is used.
__________________
Laurence R. McGlashan :: Website |
|
June 15, 2010, 06:38 |
|
#5 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
Thank you, the regionProperties helps a lot. The problem I have at the moment is that my class Tracing needs the mesh information for calculating the flame position. For example I have to use mesh.C(). I don't know how to handle this, because I don't know how to deliver the mesh Information to my header file.
I tried to use a genererell objectRegistry in the the constructor Tracing(objectRegistry reg0,...), but there doesn't exist a .C() data. Perhaps you know an example of an header-file that uses the mesh data in any way!? Something i also do not understand is the declaration of a namespace namespace Foam {..... ...} before the declaration of the class. Could you explain to me, why this is necessary? Thanks a lot in advance! Victor |
|
June 15, 2010, 07:11 |
|
#6 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Pass the mesh as an argument to the constructor:
header file: Code:
class Tracing { const fvMesh& mesh_; Tracing ( const fvMesh& mesh ); } Code:
Foam::Tracing::Tracing ( const fvMesh& mesh ) : mesh_(mesh) {} The Foam namespace isn't declared before the class,. The class is part of the namespace Foam. So Foam::regionProperties is its full name. In chtMultiRegionFoam.C you'll see: regionProperties rp(runTime); The full type would be Foam::regionProperties rp(runTime); but in the fvCFD.H file there's a using namespace Foam declaration.
__________________
Laurence R. McGlashan :: Website |
|
June 21, 2010, 03:54 |
|
#7 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
Oh, thank you really much! This is exactly I was looking for!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM13 for Mac OSX Darwin 104 | hjasak | OpenFOAM Installation | 70 | September 24, 2010 06:06 |
Problems compiling under 14 | grtabor | OpenFOAM Running, Solving & CFD | 9 | July 17, 2007 23:34 |
User Defined Scalars - Returning Values | Carlos V. | FLUENT | 0 | April 19, 2006 19:18 |
Some problems with Star CD | Micha | Siemens | 0 | August 6, 2003 14:55 |
Compiling | MON | FLUENT | 0 | October 20, 2002 21:48 |