Problem compiling neo-hokean dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jon98
    Junior Member
    • Jul 2019
    • 9

    Problem compiling neo-hokean dll

    Hi. I am trying to compile the dll for the neo-hookean material from the site, but I am encountering various problems. I am using Windows 10, and Visual Studio Professional 2015. I never used Visual Studio before, and never programmed in C++ .
    I created a new win32 project, and select the option for dll. Then I included the FENeoHookeanPI.h as header, and the dll.cpp and FENeoHookeanPI.cpp as source file. In the properties of the project I do the following steps for the release and debug configuration:
    1) In VC++ Directories I add the "include" folder from the FeBio in the include directories. I also add the "lib" folder from the Vs2015 in the library directories.
    2) In C/C++ General, I add the "include" folder in the Additional Include Directories and Additional #using Directories.
    3) In Linker General, I add the "lib" folder in the Additional Library Directories.
    4) In Linker Input, I add "FECore.lib" e "FEBioMech.lib" in the Additional Dependencies.
    Both the debug and configuration are x64 in the Platform. When I go in the release and try to build the solution, I have 31 errors (they are listed below). Any help is welcomed. The files are attached

    Error list:
    Severity Code Description Project File Line Suppression State
    Error C2065 'm_v': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 48
    Error C2065 'FENeoHookeanPI': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 16
    Error C2065 'FEElasticMaterial': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 16
    Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 16
    Error C2440 'initializing': cannot convert from 'initializer list' to 'int' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 17
    Error C2146 syntax error: missing ';' before identifier 'ADD_PARAMETER2' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 17
    Error C2065 'm_v': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 18
    Error C2065 'FE_PARAM_DOUBLE': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 18
    Error C3861 'FE_RANGE_RIGHT_OPEN': identifier not found Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 18
    Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 18
    Error C2440 'initializing': cannot convert from 'initializer list' to 'int' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 18
    Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 19
    Error C2653 'FENeoHookeanPI': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 26
    Error C2653 'FEElasticMaterial': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 29
    Error C2653 'FENeoHookeanPI': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 41
    Error C2653 'FEElasticMaterial': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 43
    Error C2065 'm_lam': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 47
    Error C2065 'm_v': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 47
    Error C2065 'm_E': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 47
    Error C2065 'm_mu': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 48
    Error C2065 'm_E': undeclared identifier Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 48
    Error C2653 'FENeoHookeanPI': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 57
    Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 57
    Error C2146 syntax error: missing ';' before identifier 'Stress' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 57
    Error C2143 syntax error: missing ';' before '{' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 58
    Error C2447 '{': missing function header (old-style formal list?) Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 58
    Error C2653 'FENeoHookeanPI': is not a class or namespace name Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 90
    Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 90
    Error C2146 syntax error: missing ';' before identifier 'Tangent' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 90
    Error C2143 syntax error: missing ';' before '{' Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 91
    Error C2447 '{': missing function header (old-style formal list?) Win32Project1 d:\Users\jon98\Desktop\neo_test\Win32Project1\Win3 2Project1\FENeoHookeanPI.cpp 91
  • maas
    Lead Code Developer
    • Nov 2007
    • 3441

    #2
    Hi Jon,

    Can you check if the WIN32 macro is defined? Go to the project properties, then under Configuration Properties -> C/C++ -> Preprocessor, find the "Preprocessor definitions" and see if WIN32 is on the list. If not, add it and try to rebuild again. Let me know what you find.

    Cheers,

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

    Comment

    • jon98
      Junior Member
      • Jul 2019
      • 9

      #3
      Hi. Thanks for the quick reply. In the preprocessor definition there is by default:
      "NDEBUG
      _WINDOWS
      _USRDLL
      WIN32PROJECT1_EXPORTS"
      I tried to add WIN32 there (I just go in the field and write WIN32, I don't know if this is correct) but it did not change anything. It still has 31 errors, which I listed in my previous post. I am attaching some images from my configuration:


      Comment

      • maas
        Lead Code Developer
        • Nov 2007
        • 3441

        #4
        Hmm, not sure what the issue could be. Your configuration properties look okay to me. It almost looks like the include statement at the top of the file is not there. Can you check if the first line of the FENeoHookeanPI.cpp is:
        Code:
        #include "FENeoHookeanPI.h"
        Steve
        Department of Bioengineering, University of Utah
        Scientific Computing and Imaging institute, University of Utah

        Comment

        • jon98
          Junior Member
          • Jul 2019
          • 9

          #5
          After a lot of trial and error, I found my mistake. The Visual Studio 2015 uses the option precompiled header by default, and so it created a "stdafx.h" by default. So when I included the command #include "stdafx.h" as the first command in the FENeoHookeanPI.cpp and dllmain.cpp, the code worked. Interesting (at least for a noob in c++ like me), if I included stdafx.h after the #include "FENeoHookeanPI.h", it will give the errors which I was encountering (and that was the problem).
          Anyway, thanks for the help.

          Comment

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