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

"undefined reference to" problem with libraries

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2020, 12:42
Default "undefined reference to" problem with libraries
  #1
New Member
 
Francesco95's Avatar
 
Francesco Latella
Join Date: Apr 2020
Location: Bergamo, Italy
Posts: 15
Rep Power: 6
Francesco95 is on a distinguished road
Hi guys,

I'm translating a modified version of Interfoam by the OpenFOAM version 2.2.1 to the latest version OpenFOAM 7. When I try to compile the code I obtain errors about one of the libraries created for this new solver. In particular I obtain an "undefined reference to" here the message

Code:
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/ag600/OpenFOAM/OpenFOAM-7/src/transportModels/twoPhaseMixture/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/transportModels -I/home/ag600/OpenFOAM/ag600-7/src_myInterFoamVOFSmoothEvap7/interfaceProperties/lnInclude -I/home/ag600/OpenFOAM/ag600-7/src_myInterFoamVOFSmoothEvap7/twoPhaseProperties/lnInclude -I/home/ag600/OpenFOAM/ag600-7/src_myInterFoamVOFSmoothEvap7/twoPhaseMixture/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/transportModels/incompressible/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/transportModels/interfaceProperties/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/TurbulenceModels/incompressible/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/finiteVolume/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/dynamicFvMesh/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/meshTools/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/sampling/lnInclude -IlnInclude -I. -I/home/ag600/OpenFOAM/OpenFOAM-7/src/OpenFOAM/lnInclude -I/home/ag600/OpenFOAM/OpenFOAM-7/src/OSspecific/POSIX/lnInclude   -fPIC -fuse-ld=bfd -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/myInterFoamVOFSmoothEvap7.o -L/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib \
	    -L/home/ag600/OpenFOAM/ag600-7/platforms/linux64GccDPInt32Opt/lib -lmyinterfaceProperties_VOFSmoothEvap -lmytwoPhaseProperties_VOFSmoothEvap -lmytwoPhaseProperties_VOFSmoothEvap -lmytwoPhaseMixture_VOFSmoothEvap -limmiscibleIncompressibleTwoPhaseMixture -lturbulenceModels -lincompressibleTurbulenceModels -lfiniteVolume -ldynamicFvMesh -ltopoChangerFvMesh -lfvOptions -lmeshTools -lOpenFOAM -ldl  \
	     -lm -o /home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/bin/myInterFoamVOFSmoothEvap7
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::regIOobject::writeObject(Foam::IOstream::streamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::IOobject::headerOk()'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::Vector<double>::zero'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::TimeState::timeIndex() const'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::sumReduce(double&, int&, int)'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::regIOobject::write() const'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::regIOobject::readStream(Foam::word const&)'
/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/lib/libmyinterfaceProperties_VOFSmoothEvap.so: undefined reference to `Foam::Vector<double>::typeName'
collect2: error: ld returned 1 exit status
make: *** [/home/ag600/OpenFOAM/OpenFOAM-7/platforms/linux64GccDPInt32Opt/bin/myInterFoamVOFSmoothEvap7] Error 1
my make/options file is this:

Code:
EXE_INC = \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(WM_PROJECT_USER_DIR)/src_myInterFoamVOFSmoothEvap7/interfaceProperties/lnInclude \
    -I$(WM_PROJECT_USER_DIR)/src_myInterFoamVOFSmoothEvap7/twoPhaseProperties/lnInclude \
    -I$(WM_PROJECT_USER_DIR)/src_myInterFoamVOFSmoothEvap7/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lmyinterfaceProperties_VOFSmoothEvap \
    -lmytwoPhaseProperties_VOFSmoothEvap \
    -lmytwoPhaseProperties_VOFSmoothEvap \
    -lmytwoPhaseMixture_VOFSmoothEvap \
    -limmiscibleIncompressibleTwoPhaseMixture \
    -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lfiniteVolume \
    -ldynamicFvMesh \
    -ltopoChangerFvMesh \
    -lfvOptions \
    -lmeshTools
and as you see, I have in the file that library. I'm really new in the OF programming world, so if you could also explain me what I'm maybe doing wrong I will be very gratefull! I know that in this file i put the link for let the compilation able to find the libraries needed for the solver. And if I understand well when I compile I find the libraries, but seems that I have some problem with functions and classes inside these libraries right? So it means that they are in correct folder no? So what's the problem with these messages?

Thank you all in advance!
Francesco95 is offline   Reply With Quote

Old   April 27, 2020, 02:11
Default
  #2
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
Hello,


Move part from FOAM_USER_LIBBIN to your libraries below OF libraries.
ybapat is offline   Reply With Quote

Old   April 27, 2020, 04:39
Default
  #3
New Member
 
Francesco95's Avatar
 
Francesco Latella
Join Date: Apr 2020
Location: Bergamo, Italy
Posts: 15
Rep Power: 6
Francesco95 is on a distinguished road
Hi Yogesh, thank you for the reply.

I have already did that. I have these libraries inside the folder $FOAM_USER_LIBBIN and inside the lib folder of OpenFOAM, and is not working
Francesco95 is offline   Reply With Quote

Old   April 27, 2020, 04:56
Default
  #4
New Member
 
Francesco95's Avatar
 
Francesco Latella
Join Date: Apr 2020
Location: Bergamo, Italy
Posts: 15
Rep Power: 6
Francesco95 is on a distinguished road
I'm thinking about that and I'm wondering if this "undefined reference to" error is due by the fact that this library is created by another person and is not an original one of OpenFOAM so I need first to compile her and only after do the wmake to the solver?
Francesco95 is offline   Reply With Quote

Old   April 27, 2020, 09:43
Default
  #5
New Member
 
Francesco95's Avatar
 
Francesco Latella
Join Date: Apr 2020
Location: Bergamo, Italy
Posts: 15
Rep Power: 6
Francesco95 is on a distinguished road
Hi guys, I tried removing the three libraries that gave me that "undefined reference to" error and now it compile! But this is something really strange that I'm not able to understand...I've just one explanation and please tell me if I'm wrong.

If the solver is compiled also without those libraries, it means that they are not needed by the solver, am I right? So, maybe, should work, no?
Francesco95 is offline   Reply With Quote

Reply

Tags
libraries, library, undefined reference, wmake error, wmake problems

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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] An Error in recompiling of openFoam-4.0 alimea OpenFOAM Installation 4 April 8, 2020 14:44
wmake problems during custom utility compilation palazi88 OpenFOAM Programming & Development 11 August 13, 2018 20:52
Simple piston movement in cylinder- fluid models arun1994 CFX 4 July 8, 2016 02:54
Error in compiling new drag model k.farnagh OpenFOAM Programming & Development 13 May 21, 2016 03:08
G95 + CGNS Bruno Main CFD Forum 1 January 30, 2007 00:34


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