简体   繁体   中英

How to get MSVS to recognized the bigobj flag?

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 have found others with this problem, but I still have not been able to figure out how to add a line in my code to get the compiler to recognize this. Based on finding other snippets of code online, I have tried to add the lines after the includes at the top of the code:

#include "udf.h"
#include "unsteady.h"
#include "dynamesh_tools.h"
ADD_DEFINITIONS(/bigobj)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")

But this gives the errors:

..\..\src\MY_UDF.c(10): error C2143: syntax error: missing ')' before '/'
..\..\src\MY_UDF.c(10): error C2143: syntax error: missing '{' before '/'
..\..\src\MY_UDF.c(10): error C2059: syntax error: '/'
..\..\src\MY_UDF.c(10): error C2059: syntax error: ')'

I don't understand these errors, as these were copied from someone else's working code. I also tried, from a different snippet I found online:

QMAKE_CXXFLAGS += -bigobj

But this gives the error below.

..\..\src\MY_UDF.c(9): error C2143: syntax error: missing '{' before '+='
..\..\src\MY_UDF.c(9): error C2059: syntax error: '+='

This is the top of my udf file, which runs until I add too many lines to it and get the error shown above.

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

I expect the code to compile but it doesn't. I have not found any solution that shows exactly how to tell the compiler what it tells me I should tell it.

Your answer is in the link below, you must just add a /bigobj to the makefile_nt.udf file of Fluent! Thats really a life saver!

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5043c081-a317-4528-a02d-d4b6e6d21543/problem-with-bigobj-when-compiled-by-other-software?forum=msbuild

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM