none
Problem with /bigobj when compiled by other software RRS feed

  • Question

  • I am building a User Defined Function in ANSYS Fluent which calls my installation of MSVS 2017 to compile the code. The problem is I get the error:

    fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj

    I cannot tell Fluent how to compile the code. The only argument it takes is where the source code is.  How can I tell Visual Studio 2017 to ALWAYS use bigobj when it compiles code?

    Monday, June 10, 2019 7:28 PM

Answers

  • Hello.

    Actually I figured it out.  For future reference in case anyone else ever finds this thread and needs to know:

    You can go to the makefile_nt.udf found in (your version may be different than 19.3):

    C:\Program Files\ANSYS Inc\v193\fluent\fluent19.3.0\src\udf

    In that file you will see these lines:

    # compile flags
    #  /c for compile only,  /Za for ansi c and __STDC__ is set
    CFLAGS = /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224

    Simply add /bigobj as the last flag.  That's all there is to it.  Fluent will compile the large file now with no problem.

    Thanks!

    Friday, June 21, 2019 9:27 PM

All replies

  • Hi matt_funker,

    Welcome to MSDN forum.

    According to this error, it seems that there are many inline functions in fluent. Please follow below steps to compile with /bigobj:

    #1 Right click your project

    #2 Choose the properties --> Configuration Properties --> C/C++ --> Command Line

    #3 Enter the "/bigobj" compiler option in the Additional Options box.

    Look forward to your feedback.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, June 11, 2019 7:36 AM
  • Hello,

    Thank you for your response, but I think there are two issues.  First, it sounds like you are talking about setting properties in a particular project within MSVS.  But I do not have a project in MSVS, rather Fluent calls the compiler to compile the code so I never even open MSVS.  But perhaps you are thinking that there is a setting that will be general for all uses of the compiler even when it is called from another outside program?  In that case opened MSVS and a new project, then I tried to follow your instructions but there is no C/C++ option under Configuration Properties in my installation, as you can see.


    • Edited by matt_funker Tuesday, June 11, 2019 11:46 PM
    Tuesday, June 11, 2019 11:45 PM
  • Perhaps you can set the CL environment variable before you start ANSYS Fluent.
    Wednesday, June 12, 2019 4:42 PM
  • Hi matt_funker,

    Thank you for reply.

    This option is in visual studio instead of MSVC, we suggest you could import your project into visual studio, then find this option in properties

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Proposed as answer by profil009 Tuesday, June 18, 2019 5:51 AM
    Friday, June 14, 2019 1:45 AM
  • Hi matt_funker

    Does your issue is solved or not? If not, could you please share the detail error message when you build the code?

    If you already found the solution, please share it in here or mark the helpful reply, that will help other community members, we can also close this thread for you, thanks for your understanding.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, June 19, 2019 11:19 AM
  • Hello,

    My problem is not solved.  I need help to try to do what you suggest, as I am more of an engineer and not a programmer.  I have had 1 semester of C++ so I do know enough to write the UDF but this other stuff is advanced for me. 

    When I compile a UDF in ANSYS and it works (without the bigobj error I encounter when I use a very large number of points), what happens is that it creates two folders in the working directory, as shown in the first image:

    My source code is named: MY_UDF_p75_small.c.  Inside each of these folders it looks like are the same exact things.  Inside both are these files:

    So I imagine that the MY_UDF_p75_small.obj is the file ANSYS actually executes.   The question is, can I use these files from within visual studio to compile to the object code there?  I see there is a make file.  It does have compiler flags in it.  Please let me know any first step you can think to try. 

    Also, I need these three lines at the top of my udf file but I do not see the header files in those.

    #include "udf.h"
    #include "unsteady.h"
    #include "dynamesh_tools.h"


    Thanks!


    Friday, June 21, 2019 7:15 PM
  • Hello.

    Actually I figured it out.  For future reference in case anyone else ever finds this thread and needs to know:

    You can go to the makefile_nt.udf found in (your version may be different than 19.3):

    C:\Program Files\ANSYS Inc\v193\fluent\fluent19.3.0\src\udf

    In that file you will see these lines:

    # compile flags
    #  /c for compile only,  /Za for ansi c and __STDC__ is set
    CFLAGS = /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224

    Simply add /bigobj as the last flag.  That's all there is to it.  Fluent will compile the large file now with no problem.

    Thanks!

    Friday, June 21, 2019 9:27 PM
  • Hi matt_funker,

    I'm glad to hear that you got it working.

    Thank you for sharing your solution. Also we appreciate that you could mark the reply as answer, it will be more beneficial to other community members with same issues find this answer.

    Have a nice day.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Saturday, June 22, 2019 1:58 AM