求解器编译问题“对‘XXX const’未定义的引用”



  • 在2.3中编译求解器,报如下错误,感觉连接问题,但是Options中已将将所有引用的头文件都包含进去了,kOmegaMHD湍流模型我已经编译到RAS源库当中了,引用湍流模型也在H文档下添加了
    报错如下:

     /home/kdd/OpenFOAM/OpenFOAM
    2.3.1/platforms/linux64GccDPOpt/lib/libincompressibleRASModels.so:对 'Foam::incompressible::RASModels::kOmegaMHD::divDevRhoReff(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const'
    collect2: error: ld returned 1 exit status
    /home/kdd/OpenFOAM/OpenFOAM-2.3.1/wmake/Makefile:149: recipe for target '/home/kdd/OpenFOAM/kdd-2.3.1/platforms/linux64GccDPOpt/bin/MHDRASpisoFoam' failed
    

    Options中引用的头文件如下

     EXE_INC = \
        -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
        -I$(LIB_SRC)/transportModels \
        -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel     \
        -I$(LIB_SRC)/turbulenceModels \
        -I$(LIB_SRC)/triSurface/lnInclude \
        -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
        -I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
        -I$(LIB_SRC)/sampling/lnInclude\
        -I$(LIB_SRC)/finiteVolume/lnInclude \
        -I$(LIB_SRC)/meshTools/lnInclude\
    EXE_LIBS = \
        -lincompressibleLESModels \
        -lincompressibleTransportModels \
        -lincompressibleTurbulenceModel \
        -lincompressibleRASModels \
        -lfiniteVolume \
        -ltriSurface \
        -lmeshTools
    

    files

    MHDRASpisoFoam.C
    EXE = $(FOAM_USER_APPBIN)/MHDRASpisoFoam
    

    在.H文档结尾处也添加了模型引用,如下

    singlePhaseTransportModel laminarTransport(U, phi);
    
    autoPtr<incompressible::turbulenceModel> turbulence
    (
        incompressible::turbulenceModel::New(U, phi, laminarTransport)
    );
    

    在查找资料时找到类似的编程错误,类似错误以及之前有提过的类似错误
    希望各位前辈和好友能指点一二,,,



  • 参照这个资料显示的说法从我的报错中可以看到报错原因是无法从libincompressible.so库中定位divDevRhoReff函数的位置,但是并没有在OpenFOAM中找到这个函数,,,或者说这个函数内置在某个库中呢,,,



  • 报错中说对divDevRhoReff函数未定义引用,关键是这个divDevRhoReff函数是可压缩函数才调用的,我的是不可压缩,在RASModels中自己添加进去kOmegaMHD模型也是不可压缩函数divDevRhoReff函数,所以这里的报错就很奇怪了。。。



  • 求解器编译成功了,,,
    将Options中动态链接库中的:-lincompressibleRASModel 去掉就编译通过了。


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2