简体   繁体   English

如何让 MSVS 识别 bigobj 标志?

[英]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.我正在 ANSYS Fluent 中构建一个用户定义的函数,它调用我安装的 MSVS 2017 来编译代码。 The problem is I get the error:问题是我收到错误:

fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj致命错误 C1128:节数超出目标文件格式限制:使用 /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.这是我的 udf 文件的顶部,它运行直到我向它添加太多行并得到上面显示的错误。

#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!您的答案在下面的链接中,您只需在 Fluent 的makefile_nt.udf文件中添加一个/bigobj即可! 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 https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5043c081-a317-4528-a02d-d4b6e6d21543/problem-with-bigobj-when-compiled-by-other-software?forum=msbuild

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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