CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Undefined reference

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2008, 09:25
Default I'm trying to compile a new cl
  #1
New Member
 
Mateusz Slowikowski
Join Date: Mar 2009
Location: Waterloo, Canada
Posts: 12
Rep Power: 17
mateusz_slowikowski is on a distinguished road
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?
mateusz_slowikowski is offline   Reply With Quote

Old   March 11, 2008, 10:21
Default Do you just type wmake? If th
  #2
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Do you just type wmake?
If the answer is yes, then use wmake libso instead.

Dragos
dmoroian is offline   Reply With Quote

Old   March 11, 2008, 10:35
Default Yes - thanks for the help. Ho
  #3
New Member
 
Mateusz Slowikowski
Join Date: Mar 2009
Location: Waterloo, Canada
Posts: 12
Rep Power: 17
mateusz_slowikowski is on a distinguished road
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 is offline   Reply With Quote

Old   March 11, 2008, 13:19
Default Ok... I've figured out that th
  #4
New Member
 
Mateusz Slowikowski
Join Date: Mar 2009
Location: Waterloo, Canada
Posts: 12
Rep Power: 17
mateusz_slowikowski is on a distinguished road
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.
mateusz_slowikowski is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.com] Undefined reference to %60yyFlexLexeryywrapb arjaan OpenFOAM Installation 13 June 1, 2016 13:33
Undefined reference mateusz_slowikowski OpenFOAM Running, Solving & CFD 7 February 27, 2015 15:35
Undefined reference to %60mainb seang OpenFOAM Installation 8 February 1, 2014 14:48
Undefined reference to %60yyFlexLexeryywrapb zhoubinwx OpenFOAM Bugs 1 May 28, 2008 06:57
MPICH : undefined reference to.. Vincent Siemens 3 March 24, 2005 13:30


All times are GMT -4. The time now is 22:47.