Trouble compiling neoHookean sample plugin in VS2015

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jrey1009
    Junior Member
    • Jul 2018
    • 29

    Trouble compiling neoHookean sample plugin in VS2015

    Hello,

    I have very limited C++ knowledge and no previous experience with Visual Studio 2015. However I am trying to compile the neo-Hookean plugin by starting a fresh Win32 project that contains the dllmain.cpp, FENeoHookeanPI.h, and FENeoHookeanPI.cpp files which can be downloaded from the FEBio website. The only difference is I have added #include "stdafx.h" to the top of the FENeoHookeanPI.cpp file and have retained some code that automatically appeared at the top of the dllmain.cpp file when the new project opened. To be clear, I copied the text within the source files downloaded from the website into source files with the same names generated from within VS2015, though I don't expect this makes a difference.

    I have added the path below to the VC++ include directories using the property page as instructed in the developers manual.
    C:\Program Files\febio-2.8.0\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\febio-2.8.0\sdk\lib\VS15\Debug

    When I hit build a receive 24 errors of type LNK2001 and LNK2019 regarding "unresolved external symbols". Here are a few examples of the errors thrown:

    1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class FEParam * __thiscall FEParamContainer::FindParameterFromData(void *)" (?FindParameterFromData@FEParamContainer@@UAEPAVFE Param@@PAX@Z)
    1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class FEParam * __thiscall FECoreBase::FindParameter(class ParamString const &)" (?FindParameter@FECoreBase@@UAEPAVFEParam@@ABVPara mString@@@Z)
    1>dllmain.obj : error LNK2001: unresolved external symbol "public: virtual class FECoreBase * __thiscall FECoreBase::GetProperty(int)" (?GetProperty@FECoreBase@@UAEPAV1@H@Z)
    1>dllmain.obj : 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)
    1>dllmain.obj : 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


    Am I linking the correct "include" and "library" directories? Any other suggestions as to what might be going wrong here? I am using the FEBio SDK 2.8.0. downloaded from the website.
    I have attached the source files I want to compile to this post.

    Thanks for your help.

    Regards,
    Julian
    Attached Files
  • maas
    Lead Code Developer
    • Nov 2007
    • 3400

    #2
    Hi Julian,

    I looks like you missed one step, you also need to specify the libraries that your plugin needs to link with. You can specify that on the Project Properties under Linker>Input. Based on what you are trying to do you will need fecore.lib and febiomech.lib. Let us know if that solved the problem.

    Cheers,

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

    Comment

    • jrey1009
      Junior Member
      • Jul 2018
      • 29

      #3
      Hi Steve,

      Thank you for the suggestions.

      I have added FECore.lib and FEBioMech.lib to the additional dependencies line under Linker>Input because that's how these libraries are named in C:\Program Files\febio-2.8.0\sdk\lib\VS15\Debug (which is the path I added previously under VC++ Directories>Library Directories). I also tried fecore.lib and febiomech.lib, but the compilation failed with these as well.

      In addition to the errors thrown previously, two new errors appeared:

      1>C:\Program Files\febio-2.8.0\sdk\lib\VS15\Debug\FECore.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
      1>C:\Program Files\febio-2.8.0\sdk\lib\VS15\Debug\FEBioMech.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'

      I was reading that maybe the libraries were made with a 64-bit machine but I'm trying to create a 32-bit application and that could be an issue, but I'm not sure how accurate that is. Maybe this provides an additional hint as to what's going wrong here.

      A couple of other details that may be helpful are that the files for my Visual Studio project are on an external drive while the febio sdk is in the C drive under program files as shown above. Also the include files seem to be recognized because #include does not appear underlined in red in the code editing area of Visual Studio. I have taken a few screen shots of the Project Properties window for reference.

      Regards,
      Julian
      Attached Files
      Last edited by jrey1009; 08-26-2019, 08:41 PM. Reason: Uploaded the wrong screenshot of Project Properties

      Comment

      • jrey1009
        Junior Member
        • Jul 2018
        • 29

        #4
        Dear Steve,

        I was wondering if you have any thoughts regarding my post from 8-26-2019. I have not tinkered with the plugin much since then in the hopes that there is an easy fix you could provide. I figure this is a project configuration problem and not so much a code problem since the source code is essentially the same as that provided through the FEBio website.

        Regards,
        Julian

        Comment

        • maas
          Lead Code Developer
          • Nov 2007
          • 3400

          #5
          Hi Julian,

          We only build 64bit versions of the FEBio libraries and I highly recommend building your plugins as 64 bit dlls as well. To make a 64bit configuration, open the configuration manager (for example, click on your configuration dropdown and select configuration manager from the menu). In the dialog box that shows up, click on the "Active solution platforms" and select New. Then, select x64 and click OK.
          You may also need to add the WIN32 preprocessor macro. (VS used to add this automatically, but recent versions don't always do that). You can check your preprocessor macros in the Properties window Configuration Properties -> C/C++ -> Preprocessor. If you don't see WIN32 under preprocessor definitions, add it. You will have to do this for both the Debug and Release configurations separately. Let me know if this solved your issues or if you have any further questions.

          Cheers,

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

          Comment

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