CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Undefined reference (https://www.cfd-online.com/Forums/openfoam-solving/59051-undefined-reference.html)

mateusz_slowikowski March 11, 2008 08:25

I'm trying to compile a new cl
 
I'm trying to compile a new class, however I'm having problems with the compilation, these are some of the errors:

OpenFOAM.out
/usr/lib/../lib64/crt1.o(.text+0x21): In function `_start':
: undefined reference to `main'
Make/linux64Gcc4DPOpt/populationBalanceModel.o(.text._ZNK4Foam14Geometri cFieldId NS_12fvPatchFieldENS_7volMeshEE4typeEv[Foam::GeometricField<double,>::type() const]+0x3): In function `Foam::GeometricField<double,>::type() const':
: undefined reference to `Foam::GeometricField<double,>::typeName'
Make/linux64Gcc4DPOpt/populationBalanceModel.o(.text._ZNK4Foam16Dimensio nedField IdNS_7volMeshEE4typeEv[Foam::DimensionedField<double,>::type() const]+0x3): In function `Foam::DimensionedField<double,>::type() const':
: undefined reference to `Foam::DimensionedField<double,>::typeName'
Make/linux64Gcc4DPOpt/populationBalanceModel.o(.text._ZNK4Foam12fvPatchF ieldIdE4 typeEv[Foam::fvPatchField<double>::type() const]+0x3): In function `Foam::fvPatchField<double>::type() const':
: undefined reference to `Foam::fvPatchField<double>::typeName'

My ".H" file has the following includes:

#ifndef populationBalanceModel_H
#define populationBalanceModel_H

#include "IOdictionary.H"
#include "dimensionedScalar.H"
#include "volFields.H"
#include "surfaceFields.H"

and my ".C" file has the following includes:

#include "populationBalanceModel.H"
#include "addToRunTimeSelectionTable.H"
#include "dimensionedScalar.H"
#include "fixedGradientFvPatchFields.H"
#include "surfaceFields.H"
#include "fvc.H"
#include "fvCFD.H"

This is the ~/make/options file:

EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/OpenFOAM/lnInclude

LIB_LIBS =

and this is the ~/make/files file:

populationBalanceModel/populationBalanceModel.C

LIB = $(WM_PROJECT_USER_DIR)/lib/linux64Gcc4DPOpt/libpopulationBalanceModel


any advice on the undefined references?

dmoroian March 11, 2008 09:21

Do you just type wmake? If th
 
Do you just type wmake?
If the answer is yes, then use wmake libso instead.

Dragos

mateusz_slowikowski March 11, 2008 09:35

Yes - thanks for the help. Ho
 
Yes - thanks for the help. However, the above was what I thought may have been the solution to an earlier problem - but it wasn't. When I try to compile the whole program, I get this error:

/home/slowikowsm/OpenFOAM/slowikowsm-1.4/applications/bin/linux64Gcc4DPOpt/settl erFoam
/usr/bin/ld: cannot find -lpopulationBalanceModel
collect2: ld returned 1 exit status

The following are the "Allwmake", "~/Make/files", and "~/Make/options" files:

#!/bin/sh
set -x

wmake libso populationBalanceModel
wmake libso phaseModel
wmake libso interfacialModels
wmake libso kineticTheoryModel
wmake
_________________________________
settlerFoam.C

EXE =$(WM_PROJECT_USER_DIR)/applications/bin/linux64Gcc4DPOpt/settlerFoam
_________________________________
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-IturbulenceModel \
-IkineticTheoryModel/lnInclude \
-IinterfacialModels/lnInclude \
-IphaseModel/lnInclude \
-IpopulationBalanceModel/lnInclude \
-Iaveraging

EXE_LIBS = \
-lEulerianInterfacialModels \
-lfiniteVolume \
-lmeshTools \
-lincompressibleTransportModels \
-lphaseModel \
-lpopulationBalanceModel \
-lkineticTheoryModel

I thought that the new library is already made...?

mateusz_slowikowski March 11, 2008 12:19

Ok... I've figured out that th
 
Ok... I've figured out that this library doesn't need to be linked to the main program.

I get another error with regard to an array of pointers that I'm passing. The error is:

createFields.H:129: error: no matching function for call to âFoam::newModel::New(Foam::volVectorField*&, Foam::volScalarField*&, Foam::IOdictionary&, Foam::IOdictionary&)â

newModel/lnInclude/newModel.H:132: note: candidates are: static Foam::autoPtr<foam::newmodel> Foam::newModel::New(Foam::volVectorField**, Foam::volScalarField**, const Foam::IOdictionary&, const Foam::IOdictionary&)

in the createFields.H this model is initialized by:
Info << "Initializing new Model" << endl;
autoPtr<newmodel> popBal = newModel::New
(
U_[Num],
n_[Num],
transportProperties,
newDictionary
);

and in the newModel.H file:
// Selectors
static autoPtr<newmodel> New
(
volVectorField *U_temp[],
volScalarField *ni_temp[],
const IOdictionary& transdict,
const IOdictionary& newdict
);

in the newModel.C file:
Foam::autoPtr<foam::newmodel> Foam::newModel::New
(
volVectorField *U_temp[],
volScalarField *ni_temp[],
const IOdictionary& transdict,
const IOdictionary& newdict
)
{
return autoPtr<newmodel>
(
new newModel(U_temp,ni_temp,transdict,newdict)
);
}

There's some kind of an error with the pointer structure, but I'm not sure how to solve it.


All times are GMT -4. The time now is 15:01.