wxWidgets的应用程序如果静态链接的话有多大的size?

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
snail_314
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Apr 10, 2013 3:27 am

wxWidgets的应用程序如果静态链接的话有多大的size?

Post by snail_314 »

初来,之前用wxPython,蛮喜欢,没搞过wxWidgets,请教一下,谢谢
fancyivan
Experienced Solver
Experienced Solver
Posts: 80
Joined: Wed May 26, 2010 8:42 am
Location: Beijing, China
Contact:

Re: wxWidgets的应用程序如果静态链接的话有多大的size?

Post by fancyivan »

使用MinGW(gcc4.x)
wxWidgets2.8.12最小的程序在1.8M左右。
wxWidgets2.9.4最小的程序在3.5M左右。

VC++未测试,可能会更小一些。
snail_314 wrote:初来,之前用wxPython,蛮喜欢,没搞过wxWidgets,请教一下,谢谢
OS: Win7 Ultimate SP1 x64(Windows XP Pro SP3 in VirtualBox)
Compiler: MinGW32 (gcc4.8.1 + gdb7.6.1)
IDE: Code::Blocks 12.11
Lib: wxWidgets3.0.0
snail_314
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Apr 10, 2013 3:27 am

Re: wxWidgets的应用程序如果静态链接的话有多大的size?

Post by snail_314 »

谢谢啊,那很小了啊,vs编译的应该更小吧,比qt小啊,不错
wjjroy
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Apr 11, 2013 1:35 pm

Re: wxWidgets的应用程序如果静态链接的话有多大的size?

Post by wjjroy »

跟2楼的同学说的一样,现在在用2.9.4,MinGW自己编译的版本,新建的wxSmith工程最原始的release是3.83MB,Debug是惊人的77.6MB
稍微做个小应用的话,一般release是4.xMB,蛮小的。
snail_314
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Apr 10, 2013 3:27 am

Re: wxWidgets的应用程序如果静态链接的话有多大的size?

Post by snail_314 »

thanks
编译了一个minimal的带frame和菜单的example,用的vc+6.0,静态编译,1.25m,还是蛮小的

问一下大家,一些基础数据抽象比如string, hashmap, filestream等,大家倾向于直接用wxString, wxArray, wxHashMap等还是用STL的std::string, std::vector呢?理由是什么?谢谢
samsam598
Super wx Problem Solver
Super wx Problem Solver
Posts: 340
Joined: Mon Oct 06, 2008 12:55 pm

Re: wxWidgets的应用程序如果静态链接的话有多大的size?

Post by samsam598 »

snail_314 wrote:thanks
编译了一个minimal的带frame和菜单的example,用的vc+6.0,静态编译,1.25m,还是蛮小的

问一下大家,一些基础数据抽象比如string, hashmap, filestream等,大家倾向于直接用wxString, wxArray, wxHashMap等还是用STL的std::string, std::vector呢?理由是什么?谢谢
可以大概翻看一下setup.h (wx\include\wx\msw\setup.h)

Code: Select all


// ----------------------------------------------------------------------------
// Interoperability with the standard library.
// ----------------------------------------------------------------------------

// Set wxUSE_STL to 1 to enable maximal interoperability with the standard
// library, even at the cost of backwards compatibility.
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
#define wxUSE_STL 0

// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS.
//
// Currently the Digital Mars and Watcom compilers come without standard C++
// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have
// them (e.g. from STLPort).
//
// VC++ 5.0 does include standard C++ library headers, however they produce
// many warnings that can't be turned off when compiled at warning level 4.
#if defined(__DMC__) || defined(__WATCOMC__) \
        || (defined(_MSC_VER) && _MSC_VER < 1200)
    #define wxUSE_STD_DEFAULT  0
#else
    #define wxUSE_STD_DEFAULT  1
#endif

// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
//
// Notice that the compilers mentioned in wxUSE_STD_DEFAULT comment above don't
// support using standard containers and that VC6 needs non-default options for
// such build to avoid getting "fatal error C1076: compiler limit : internal
// heap limit reached; use /Zm to specify a higher limit" in its own standard
// headers, so you need to ensure you do increase the heap size before enabling
// this option for this compiler.
//
// Default is 0 for compatibility reasons.
//
// Recommended setting: 1 unless compatibility with the official wxWidgets
// build and/or the existing code is a concern.
#define wxUSE_STD_CONTAINERS 1

// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
//                      dependency on the standard streams library is not a
//                      problem
#define wxUSE_STD_IOSTREAM  wxUSE_STD_DEFAULT

// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
//                      the standard C++ library at all.
#define wxUSE_STD_STRING  wxUSE_STD_DEFAULT

// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
// allowing implicit conversion to "const char *" and "const wchar_t *".
//
// Because a lot of existing code relies on these conversions, this option is
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of
// wxWidgets.
#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL
Regards,
Sam
-------------------------------------------------------------------
Windows 10 64bit
VS Community 2019
msys2-mingw13.2.0 C::B character set: UTF-8/GBK(Chinese)
wxWidgets 3.3/3.2.4 Unicode Mono Static gcc static build
Post Reply