CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   undefined symbol error (https://www.cfd-online.com/Forums/openfoam-programming-development/221996-undefined-symbol-error.html)

insane November 7, 2019 06:42

undefined symbol error
 
Hi everyone
Recently, I developed a new class named ControllerStateProvider in the src fold and use the allwmake to compile it and there is no error.
After that, I modify the rigidbodyState (a function object to get the state of moving body) and add several lines about the ControllerStateProvider class , and I have modify the option of the rigidbodyState, just like this

Code:


EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/lnInclude \
    -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
    -I$(LIB_SRC)/ControllerStateProvider/lnInclude \
    -I$(LIB_SRC)/rigidBodyDynamics/lnInclude \
    -I$(LIB_SRC)/rigidBodyMeshMotion/lnInclude \
    -I$(LIB_SRC)/OpenFOAM/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude
   

LIB_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -L $(FOAM_LIBBIN) \
    -L $(FOAM_USER_LIBBIN) \
    -lControllerStateProvider \
    -ldynamicFvMesh \

I also include the ControllerStateProvider.H in the rigidbodyState.C and rigidbodyState could be successfully compiled.

but when I run a test case which use the interDyMFoam, it shows warning just like this

Code:

--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1604
    dlopen error : /home/ian/OpenFOAM/ian-v1712/platforms/linux64GccDPInt32Opt/lib/librigidBodyState.so: undefined symbol: _ZN4Foam23ControllerStateProvider8positionE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 105
    could not load "librigidBodyState.so"
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::dictionary&, const Foam::word&, const TablePtr&) [with TablePtr = Foam::HashTable<Foam::autoPtr<Foam::functionObject> (*)(const Foam::word&, const Foam::Time&, const Foam::dictionary&), Foam::word, Foam::string::hash>*]
    in file lnInclude/dlLibraryTableTemplates.C at line 62
    Could not open library "librigidBodyState.so"

It's clear that the function object could not work, I am sure it works before the modification of rigidbodyState. And I have read several threads similar to this error which said it can be fixed by adding the corresponding lib in the option, but i have already added ControllerStateProvider in the option file .
Could anyone offer some advice? It will be much appreciated!


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