没有框架的C ++ GUI [英] C++ GUI without Frameworks

查看:99
本文介绍了没有框架的C ++ GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,据我所知,没有办法有一个C ++ GUI设计器,并将您的应用程序作为一个独立的可执行文件。所有第三方框架以.dll-s等形式添加它们的依赖关系,无论是MFC,Qt,WTL,wxWidgets,GTK。这让我只有一个解决方案 - 设计我的当前应用程序的GUI自己使用Win32 API。我的假设是正确的,还是我错过了什么?我一直想知道uTorrent和一些其他人如何设法做到这一点。感谢。

So as far as I understand it, there is no way to have a C++ GUI designer and ship your application as one, standalone executable. All the 3rd party frameworks add their dependencies in form of .dll-s etc., be it MFC, Qt, WTL, wxWidgets, GTK. That leaves me with only one solution - design the GUI for my current application myself using Win32 API. Are my assumptions correct or am I missing something? I've always wondered how uTorrent and some others have managed to do it. Thanks.

推荐答案

不,你可以静态链接大多数流行的GUI框架,包括MFC,Qt,ATL / WTL wxWidgets。我不知道GTK,但我假设你可能也可以静态链接它。

No, you can statically link most of the popular GUI frameworks, including MFC, Qt, ATL/WTL, and wxWidgets. I don't know about GTK, but I assume that you probably can statically link it, too.

静态链接意味着,而不是动态链接到库代码生活一个DLL,你直接链接到你的可执行文件,导致一个单独的EXE文件,你可以没有任何外部依赖关系。

Statically linking means that instead of dynamically linking to the library code living in a DLL, you link that code directly into your executable, resulting in a single, standalone EXE file you can ship without any external dependencies.

但是,仍然会 在那里,他们将仍然膨胀可执行文件的大小,这可能是一个问题,这取决于您的部署机制。此外,有一些东西要说接近金属的编程,所以直接使用Win32 API绝对是一个选择。这将产生可能的最小,最轻的应用程序,也可能是最快的。事实上,我相信这正是μTorrent所做的(或至少,它是他们以前做过几个版本的前)。

But of course, those dependencies will still be there and they will still bloat the size of your executable, which may be a problem, depending on your deployment mechanism. Also, there's something to be said for programming close to the metal, so using the Win32 API directly is definitely an option. That's going to produce the absolutely smallest, lightest application possible, and probably the fastest, too. In fact, I believe this is precisely what μTorrent does (or at least, it's what they used to do several versions ago).

这篇关于没有框架的C ++ GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆