Closed Vahid-Galavi closed 6 years ago
Yes, it is a visibility problem, for security reasons msvc do not expose any symbol while compiling a DLL, so we need to manually add it.
Both errors means basically that the application core is not visible.
You have to change: https://github.com/KratosMultiphysics/Kratos/blob/master/applications/PoromechanicsApplication/poromechanics_application.h#L70
and the corresponding file in the Geomechanins app so the simbol is exported through the KRATOS_API() macro like that:
class KRATOS_API(POROMECHANICS_APPLICATION) KratosPoromechanicsApplication : public KratosApplication
{
// code
}
Make sure that in the geomechanics application you have the following line in the CMake.txt File:
set_target_properties( KratosGeomechanicsCore PROPERTIES COMPILE_DEFINITIONS "GEOMECHANICS_APPLICATION=EXPORT,API")
If it does not work, please tell me the branch you are working on and I'll try to push the fix tomorow
Thank you very much for your prompt reply.
Yes, it works!
Thanks @roigcarlo !!
@roigcarlo @pooyan-dadvand
PoromechanicsApps and GeoMechanicsApps give the same error in Windows. They are compiled fine on Linux. I am using Visual Studion 2017. Any idea, what can cause this error?
2> Creating library D:/Libraries/FEM/Kratos/cmake_build64/applications/PoromechanicsApplication/Release/KratosPoromechanicsApplication.lib and object D:/Libraries/FEM/Kratos/cmake_build64/applications/PoromechanicsApplication/Release/KratosPoromechanicsApplication.exp
2>poromechanics_python_application.obj : error LNK2019: unresolved external symbol "public: cdecl Kratos::KratosPoromechanicsApplication::KratosPoromechanicsApplication(void)" (??0KratosPoromechanicsApplication@Kratos@@QEAA@XZ) referenced in function "public: class pybind11::handle cdecl::operator()(struct pybind11::detail::function_call &)const " (??R@@QEBA?AVhandle@pybind11@@AEAUfunction_call@detail@2@@Z)
2>D:\Libraries\FEM\Kratos\cmake_build64\applications\PoromechanicsApplication\Release\KratosPoromechanicsApplication.pyd : fatal error LNK1120: 1 unresolved externals
2>Done building project "KratosPoromechanicsApplication.vcxproj" -- FAILED.
1>geo_mechanics_python_application.cpp
1> Creating library D:/Libraries/FEM/Kratos/cmake_build64/applications/GeoMechanicsApplication/Release/KratosGeoMechanicsApplication.lib and object D:/Libraries/FEM/Kratos/cmake_build64/applications/GeoMechanicsApplication/Release/KratosGeoMechanicsApplication.exp
1>geo_mechanics_python_application.obj : error LNK2019: unresolved external symbol "public: cdecl Kratos::KratosGeoMechanicsApplication::KratosGeoMechanicsApplication(void)" (??0KratosGeoMechanicsApplication@Kratos@@QEAA@XZ) referenced in function "public: void cdecl::operator()(struct pybind11::detail::value_and_holder &)const " (??R@@QEBAXAEAUvalue_and_holder@detail@pybind11@@@Z)
1>D:\Libraries\FEM\Kratos\cmake_build64\applications\GeoMechanicsApplication\Release\KratosGeoMechanicsApplication.pyd : fatal error LNK1120: 1 unresolved externals
1>Done building project "KratosGeoMechanicsApplication.vcxproj" -- FAILED.