Need help addressing LNK2001 and LNK2019 errors in compiling NeoHookean Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Brendym
    Junior Member
    • Jan 2020
    • 4

    Need help addressing LNK2001 and LNK2019 errors in compiling NeoHookean Plugin

    Hello,

    I am trying to write my own plugin for FEBio. I don’t have much experience with C++ or Visual Studio 2013. I am trying to compile the Neo-Hookean Plugin. I begin by opening of fresh Win32 project. I select File -> New -> Project, given it a name (In this case, NeoHookean) and click “OK”. I hit next, select DLL as the application type and uncheck “Security Development Lifecycle (SDL) checks”, then I hit “Finish”.

    I have added the path below to the VC++ include directories using the property page as instructed in the developers manual.
    C:\Program Files\FEBio2.9\sdk\include

    I have also added the path below to the VC++ library directories using the property page as instructed in the developers manual.
    C:\Program Files\FEBio2.9\sdk\vs2013\Debug\lib

    I copied the text from within the sources files downloaded from the website into the source files with the same names generated from within VS2013 and hit BUILD-> BUILD NeoHookean. I then proceed to get LNK2001 and LNK2019 errors (Exact ones are specified below).

    I saw on a previous thread that I might have missed a step to correct this. In that thread it was suggested that I go to Project Properties -> Linker -> Input and specify FECore.lib and FEBioMech.lib. However, when I add these libraries, it still does not resolve the issue. What am I missing and how can I resolve this issue?

    Any help would be greatly appreciate! Thanks!

    -Brendyn

    Error 1 error LNK2001: unresolved external symbol "public: virtual class FEParam * __thiscall FEParamContainer::FindParameterFromData(void *)" (?FindParameterFromData@FEParamContainer@@UAEPAVFE Param@@PAX@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 2 error LNK2001: unresolved external symbol "public: virtual class FEParam * __thiscall FECoreBase::FindParameter(class ParamString const &)" (?FindParameter@FECoreBase@@UAEPAVFEParam@@ABVPara mString@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 3 error LNK2001: unresolved external symbol "public: virtual class FECoreBase * __thiscall FECoreBase::GetProperty(int)" (?GetProperty@FECoreBase@@UAEPAV1@H@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 4 error LNK2019: unresolved external symbol "public: __thiscall FECoreFactory::FECoreFactory(unsigned int,char const *)" (??0FECoreFactory@@QAE@IPBD@Z) referenced in function "public: __thiscall FERegisterClass_T<class FENeoHookeanPI>::FERegisterClass_T<class FENeoHookeanPI>(unsigned int,char const *)" (??0?$FERegisterClass_T@VFENeoHookeanPI@@@@QAE@IPB D@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 5 error LNK2019: unresolved external symbol "public: virtual __thiscall FECoreFactory::~FECoreFactory(void)" (??1FECoreFactory@@UAE@XZ) referenced in function __unwindfunclet$??0?$FERegisterClass_T@VFENeoHooke anPI@@@@QAE@IPBD@Z$0 c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 6 error LNK2019: unresolved external symbol "public: static class FECoreKernel & __cdecl FECoreKernel::GetInstance(void)" (?GetInstance@FECoreKernel@@SAAAV1@XZ) referenced in function "public: __thiscall FERegisterClass_T<class FENeoHookeanPI>::FERegisterClass_T<class FENeoHookeanPI>(unsigned int,char const *)" (??0?$FERegisterClass_T@VFENeoHookeanPI@@@@QAE@IPB D@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 7 error LNK2019: unresolved external symbol "public: static void __cdecl FECoreKernel::SetInstance(class FECoreKernel *)" (?SetInstance@FECoreKernel@@SAXPAV1@@Z) referenced in function _PluginInitialize c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 8 error LNK2019: unresolved external symbol "public: void __thiscall FECoreKernel::RegisterFactory(class FECoreFactory *)" (?RegisterFactory@FECoreKernel@@QAEXPAVFECoreFacto ry@@@Z) referenced in function "public: __thiscall FERegisterClass_T<class FENeoHookeanPI>::FERegisterClass_T<class FENeoHookeanPI>(unsigned int,char const *)" (??0?$FERegisterClass_T@VFENeoHookeanPI@@@@QAE@IPB D@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 9 error LNK2001: unresolved external symbol "public: virtual void __thiscall FEMaterial::Serialize(class DumpStream &)" (?Serialize@FEMaterial@@UAEXAAVDumpStream@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 10 error LNK2001: unresolved external symbol "public: virtual class mat3ds __thiscall FESolidMaterial::PK2Stress(class FEMaterialPoint &,class mat3ds)" (?PK2Stress@FESolidMaterial@@UAE?AVmat3ds@@AAVFEMa terialPoint@@V2@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 11 error LNK2001: unresolved external symbol "public: virtual class tens4ds __thiscall FESolidMaterial::MaterialTangent(class FEMaterialPoint &,class mat3ds)" (?MaterialTangent@FESolidMaterial@@UAE?AVtens4ds@@ AAVFEMaterialPoint@@Vmat3ds@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 12 error LNK2001: unresolved external symbol "public: virtual double __thiscall FESolidMaterial:ensity(void)" (?Density@FESolidMaterial@@UAENXZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 13 error LNK2001: unresolved external symbol "public: virtual void __thiscall FESolidMaterial::SetDensity(double)" (?SetDensity@FESolidMaterial@@UAEXN@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 14 error LNK2019: unresolved external symbol "public: __thiscall FEElasticMaterialPoint::FEElasticMaterialPoint(voi d)" (??0FEElasticMaterialPoint@@QAE@XZ) referenced in function "public: virtual class FEMaterialPoint * __thiscall FEElasticMaterial::CreateMaterialPointData(void)" (?CreateMaterialPointData@FEElasticMaterial@@UAEPA VFEMaterialPoint@@XZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 15 error LNK2019: unresolved external symbol "public: __thiscall FEElasticMaterial::FEElasticMaterial(class FEModel *)" (??0FEElasticMaterial@@QAE@PAVFEModel@@@Z) referenced in function "public: __thiscall FENeoHookeanPI::FENeoHookeanPI(class FEModel *)" (??0FENeoHookeanPI@@QAE@PAVFEModel@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 16 error LNK2019: unresolved external symbol "public: virtual __thiscall FEElasticMaterial::~FEElasticMaterial(void)" (??1FEElasticMaterial@@UAE@XZ) referenced in function "public: virtual __thiscall FENeoHookeanPI::~FENeoHookeanPI(void)" (??1FENeoHookeanPI@@UAE@XZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 17 error LNK2001: unresolved external symbol "public: virtual double __thiscall FEElasticMaterial::StrainEnergyDensity(class FEMaterialPoint &)" (?StrainEnergyDensity@FEElasticMaterial@@UAENAAVFE MaterialPoint@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 18 error LNK2001: unresolved external symbol "public: virtual void __thiscall FEElasticMaterial::SetLocalCoordinateSystem(class FEElement &,int,class FEMaterialPoint &)" (?SetLocalCoordinateSystem@FEElasticMaterial@@UAEX AAVFEElement@@HAAVFEMaterialPoint@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 19 error LNK2001: unresolved external symbol "public: virtual bool __thiscall FEElasticMaterial::SetAttribute(char const *,char const *)" (?SetAttribute@FEElasticMaterial@@UAE_NPBD0@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\dllmain.obj NeoHookean
    Error 20 error LNK2019: unresolved external symbol "public: void __thiscall FEParamContainer::AddParameter(void *,enum FEParamType,int,class RANGE,char const *)" (?AddParameter@FEParamContainer@@QAEXPAXW4FEParamT ype@@HVRANGE@@PBD@Z) referenced in function "protected: virtual void __thiscall FENeoHookeanPI::BuildParamList(void)" (?BuildParamList@FENeoHookeanPI@@MAEXXZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\NeoHookean.obj NeoHookean
    Error 21 error LNK2019: unresolved external symbol "public: virtual bool __thiscall FEMaterial::Init(void)" (?Init@FEMaterial@@UAE_NXZ) referenced in function "public: virtual bool __thiscall FENeoHookeanPI::Init(void)" (?Init@FENeoHookeanPI@@UAE_NXZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\NeoHookean.obj NeoHookean
    Error 22 error LNK2019: unresolved external symbol "protected: virtual void __thiscall FESolidMaterial::BuildParamList(void)" (?BuildParamList@FESolidMaterial@@MAEXXZ) referenced in function "protected: virtual void __thiscall FENeoHookeanPI::BuildParamList(void)" (?BuildParamList@FENeoHookeanPI@@MAEXXZ) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\NeoHookean.obj NeoHookean
    Error 23 error LNK2019: unresolved external symbol "public: class mat3ds __thiscall FEElasticMaterialPoint::LeftCauchyGreen(void)" (?LeftCauchyGreen@FEElasticMaterialPoint@@QAE?AVma t3ds@@XZ) referenced in function "public: virtual class mat3ds __thiscall FENeoHookeanPI::Stress(class FEMaterialPoint &)" (?Stress@FENeoHookeanPI@@UAE?AVmat3ds@@AAVFEMateri alPoint@@@Z) c:\Users\brendym\documents\visual studio 2013\Projects\NeoHookean\NeoHookean\NeoHookean.obj NeoHookean
  • maas
    Lead Code Developer
    • Nov 2007
    • 3436

    #2
    Hi Brendyn,

    My best guess is that you did not create a x64 configuration. All FEBio libraries are 64 bit and in VS2013 you have to manually create the x64 configuration. To do that, do the following steps:

    1. Find the Configuration Manager. You can get to it by clicking on the dropdown box where it says Win32, and then selecting "Configuration Manager …"
    2. In the Configuration Manager dialog, click on the Active Solution Configuration and select <New...> to open the New Solution Platform dialog.
    3. In the New Solution Platform dialog, select x64 and click OK on all dialog boxes.

    Make sure the x64 configuration is now selected on the main toolbar and also double-check the Include, Library, and Linker settings for this configuration. Then, rebuild and cross your fingers

    Let me know what you find.

    Cheers,

    Steve
    Department of Bioengineering, University of Utah
    Scientific Computing and Imaging institute, University of Utah

    Comment

    • Brendym
      Junior Member
      • Jan 2020
      • 4

      #3
      Hi Steve,

      Thank you so much for your quick reply! That seemed to resolve the issue!

      Comment

      • Brendym
        Junior Member
        • Jan 2020
        • 4

        #4
        I was able to compile the NeoHookeanPI code and generate a DLL file. I noticed that the file I generated was about 2,840 KB while the NeoHookeanPI.DLL provided with the downloaded zip file was only 99 KB. Is there a reason for this?

        Also, when I attempted to load the new DLL file into FEBio, the executable crashed. When I went to debug it, I got a message saying "Unhandled exception at 0x000007FE9EB7142F (FENeoHookeanPI.dll) in FEBio2.exe: 0xC0000005: Access violation reading location 0x0000000043D6D08. Looking at the code, it crashed in FECoreKernel.h, line 186: fecore.RegisterFactory(this).

        Any thoughts as to why this occurred and how I can work around this? Thank again so much for your help on this! I definitely am in new territory. I've included a picture of the error in the hopes that it helps debug the situation and find a solution.

        ErrorPic.JPG

        Comment

        • maas
          Lead Code Developer
          • Nov 2007
          • 3436

          #5
          My guess is that you are trying to use a Debug version of your dll with the FEBio executable. This may also explain the size difference since Debug and Release versions of your dll will usually have different sizes as a result of the different compiler settings. So, double-check that you built a Release version and that you are using that one with the FEBio executable.
          The SDK download does come with a Debug version of FEBio, which you can use for testing, so you can try that one with your Debug version.

          Best,

          Steve
          Department of Bioengineering, University of Utah
          Scientific Computing and Imaging institute, University of Utah

          Comment

          Working...
          X
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎