|
[Sponsors] |
undefined reference when adding new member function |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 17, 2011, 11:08 |
undefined reference when adding new member function
|
#1 |
Member
Florian Ettner
Join Date: Mar 2009
Location: Munich, Germany
Posts: 41
Rep Power: 17 |
Hello,
this has cost me six hours so far: I want to add a new member function to the hCombustionThermo class. I've boiled it down to the simplest possbile problem. In hCombustionThermo.H I write: Code:
void hello(); In my solver (based on reactingFoam) I write: Code:
Info<< nl << "Reading thermophysicalProperties" << endl; autoPtr<hPsiChemistryModel> pChemistry ( hPsiChemistryModel::New(mesh) ); hPsiChemistryModel& chemistry = pChemistry(); hCombustionThermo& thermo = chemistry.thermo(); thermo.hello(); // the only change Code:
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/compressible/turbulenceModel -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/compressible/RAS/lnInclude -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/src/thermophysicalModels/reactionThermo/lnInclude -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/src/thermophysicalModels/basic/lnInclude -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/src/thermophysicalModels/specie/lnInclude -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/src/thermophysicalModels/chemistryModel/lnInclude -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/engine/lnInclude -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/ODE/lnInclude -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/applications/solvers/flameTracing -I/nfs/home/ettner/OpenFOAM/ettner-1.7.1/src/interpolationLookUpTable -IlnInclude -I. -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude -I/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/src/OSspecific/POSIX/lnInclude -fPIC Make/linux64Gcc43DPOpt/ddtLookup.o -L/nfs/opt/OpenFOAM/OpenFOAM-1.7.1/lib/linux64Gcc43DPOpt \ -L/nfs/home/ettner/OpenFOAM/ettner-1.7.1/lib/linux64Gcc43DPOpt -lmyreactionThermophysicalModels -lmybasicThermophysicalModels -lmychemistryModel -lmyspecie -lfiniteVolume -lcompressibleRASModels -lcompressibleLESModels -lengine -lODE -lOpenFOAM -liberty -ldl -lm -o /nfs/home/ettner/OpenFOAM/ettner-1.7.1/applications/bin/linux64Gcc43DPOpt/ddtLookup Make/linux64Gcc43DPOpt/ddtLookup.o: In function `main': ddtLookup.C:(.text+0x1bbd): undefined reference to `Foam::hCombustionThermo::hello()' collect2: ld returned 1 exit status make: *** [/nfs/home/ettner/OpenFOAM/ettner-1.7.1/applications/bin/linux64Gcc43DPOpt/ddtLookup] Error 1 |
|
May 17, 2011, 12:00 |
|
#2 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
[QUOTE=dohnie;307983]
I want to add a new member function to the hCombustionThermo class. I've boiled it down to the simplest possbile problem. In hCombustionThermo.H I write: Code:
void hello(); Code:
void hello (){} If you need to extend some class, declare your own class inherited from the existing class, like this: Code:
class my_hCombustionThermo : public hCombustionThermo { void hello () {} }; |
|
May 17, 2011, 12:06 |
|
#3 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21 |
You have a prototype for the hello() function, but no implementation of it. That is causing the problem you posted. I think you may have boiled it down too far?
|
|
May 19, 2011, 04:31 |
|
#4 |
Member
Florian Ettner
Join Date: Mar 2009
Location: Munich, Germany
Posts: 41
Rep Power: 17 |
Thanks to both of you, I'll give it another try!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |
Could you please help me about the VTKFoam | liugx212 | OpenFOAM Pre-Processing | 5 | February 13, 2008 11:31 |
Parallel processing problem with mpich | nzy102 | OpenFOAM Running, Solving & CFD | 14 | October 18, 2007 00:05 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 06:27 |
G95 + CGNS | Bruno | Main CFD Forum | 1 | January 30, 2007 00:34 |