mingw“太多部分”在QT中编译大型标头文件时错误

发布于 2025-02-06 18:22:34 字数 344 浏览 0 评论 0原文

我试图编译exprtk.hpp文件( https://exprtk.codeplex.com/ ) 491_32)在QT(Win7)上。 在编译期间,我给出了此错误消息:

debug\main.o:-1: error: too many sections (35325)

我已经注意到Exprtk.hpp文件很大(> 32000行)。 我一直在尝试在编译器上进行优化标志,但这对Eighter没有帮助。 如果有人帮助我,我会很感激... 问候,

I was trying to compile exprtk.hpp file (https://exprtk.codeplex.com/) with mingw32(491_32) on Qt (win7).
During compilation, I give this error message:

debug\main.o:-1: error: too many sections (35325)

I've been noticed that the exprtk.hpp file is huge (>32000 lines).
I've been trying optimization flags on compiler but It didn't help eighter.
I'll be appreciated if somebody help me...
Regards,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

所有深爱都是秘密 2025-02-13 18:22:34

您可以通过添加汇编标志-flto -wl,-allow-multiple-definition,您可以添加-fuse-linker-plugin

-wa,-mbig,-mbig -OBJx86/32bits架构上不起作用(仅x64

You can by adding the compilation flags -flto -Wl,-allow-multiple-definition and you can add -fuse-linker-plugin

-Wa,-mbig-obj do not work on x86/32bits architecture (only x64)

随风而去 2025-02-13 18:22:34

如此巨大的仅标头代码已经很糟糕,我宁愿使用另一个库,例如 muparser

您的问题已经在其他线程中进行了讨论,例如 this

您已经注意到,将 /bigobj传递给微软的编译器
导致其输出带有多达2^31个部分的庞大的Coff格式,
“对于任何人来说应该足够。”

我已经用mingw-w64测试了这个新选项,并且可以使用。你需要
通过-wa,-mbig-obj到GCC,选择加入大物体(-wa表示通行证
此选项给汇编程序)。 - 弗朗西斯·加格纳(FrancisGagné)

Such huge header-only code is already bad design, i'd rather recommend to use another library, like muParser.

Your problem was already discussed in other threads, like this.

As you've already noticed, passing /bigobj to Microsoft's compiler
causes it to output a munged COFF format with up to 2^31 sections,
which "should be enough for anybody."

I've tested this new option with MinGW-w64 and it works. You need to
pass -Wa,-mbig-obj to gcc to opt-in to big objects (-Wa means pass
this option to the assembler). – Francis Gagné

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文