Qt 有资源系统限制吗?

发布于 2024-09-04 05:19:41 字数 364 浏览 3 评论 0原文

我的 Qt 应用程序依赖于 Oracle DLL 来启动。由于它的大部分内容都是静态链接的(除了这些 DLL),我想将 DLL 和 EXE 嵌入到一个启动器中,该启动器的行为就像一个完全静态的应用程序(一个 exe,没有 DLL)。

启动器会将包含的文件提取到临时目录中,启动软件,并在完成后进行清理。

我尝试使用 Qt 资源系统将 EXE 和 Oracle DLL(大约 30 MB)嵌入到启动器中,但是编译器(MSVC 2005)失败并显示

致命错误 C1001:编译器中发生内部错误。

Qt 资源系统中包含的资源是否有大小限制(或者我是否通过在可执行文件中包含如此大的文件来滥用它)?

My Qt application depends on Oracle DLLs to start. As it's linked statically for the most part (except for these DLLs), I'd like to embed the DLLs and the EXE into a launcher that would behave like a fully static application (one exe, no DLLs to take along).

The launcher would extract the included files in a temp directory, launch the software, and clean up when done.

I've tried to embed the EXE and the Oracle DLLs (around 30 MB) in the launcher using Qt resource system, but the compiler (MSVC 2005) fails with

fatal error C1001: An internal error has occurred in the compiler.

Is there a size limit for resources included with Qt's resource system (or do I abuse it by including such large files in my executable)?

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

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

发布评论

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

评论(3

谎言 2024-09-11 05:19:41

如果单独拆分二进制文件行不通,则可以为二进制文件的每一块使用一个资源文件。

这样,生成的 cpp 文件会小得多,并且编译器能够处理它。

我很幸运,拥有 10 MB 的块,因此可以生成 5 个资源文件(1 个用于未分割的 DLL,4 个用于较大 DLL 的块)。

请记住在使用前加入块!

If splitting the binary file alone won't do, using one resource file per chunk of the binary file will.

This way, the resulting cpp file is much smaller and the compiler is able to process it.

I've been lucky with 10 MB chunks, so that makes 5 resources files (one for the unsplit DLLs and 4 for the chunks of the larger DLL).

Just remember to join the chunks before use !

长安忆 2024-09-11 05:19:41

限制来自编译器,因为错误表明它是内部编译器错误。所以编译器无法处理它。您可以尝试通过将较大的文件拆分为小部分并手动将它们放在代码中来解决它。我不确定它是否有效,但值得尝试。

Limit comes from compiler, as error says it is INTERNAL compiler error. So compiller couldn't handle it. You could try to walkaround it, by splitting bigger files in to small parts and manualy put them together in your code. I'm not sure if it will work, but it is worth trying.

闻呓 2024-09-11 05:19:41

Qt资源由资源编译器处理,并为每个.qrc文件生成.cpp文件。我想你生成的.cpp文件很大(应该超过30MB),VC编译器无法编译这么大的源文件。

Qt resources are processed by resource compiler and .cpp file is generated for each .qrc file. I suppose your generated .cpp file is huge (should be more than 30MB) and VC compiler just can't compile such huge source file.

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