executable very huge ????
executable very huge ????
Hi! I'm new since a couple of days with wxWidgets . Hope some wxGuru's can help me with this .
After tried out a little under Linux, it seems to be easier to build GUI with wxWidgets in Windows, so I've go to my Win2000 a little to try it. I've install the wx-devcpp and compile a simple application that contains only one wxFrame, two wxSizer and three wxButton, it's very simple.
I have been very surprised when I saw the size of the executable that result from this simple interface. A huge monster of 3,621 KB (~3.5M) ! After reading the last thread, I've tried to strip it and optimize the size and I got an executable size of 2,027 KB.
Here is the build command:
g++.exe newProgramFrameApp.o newProgramFrame.o Project2_private.res -o "Project2.exe" -L"G:/Program Files/wxDev-Cpp/lib" -mwindows -lwxmsw25 -lwxmsw25_gl -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lopengl32 -lodbc32 -Os -s
Normaly, with MFC for example or pure WIN32 API this kind of application should take about 50 KB.
I would like to know if this is normal and if it is not, which I hope, where is my mistake and how can I produce a smaller executable ?
Thanks !!
After tried out a little under Linux, it seems to be easier to build GUI with wxWidgets in Windows, so I've go to my Win2000 a little to try it. I've install the wx-devcpp and compile a simple application that contains only one wxFrame, two wxSizer and three wxButton, it's very simple.
I have been very surprised when I saw the size of the executable that result from this simple interface. A huge monster of 3,621 KB (~3.5M) ! After reading the last thread, I've tried to strip it and optimize the size and I got an executable size of 2,027 KB.
Here is the build command:
g++.exe newProgramFrameApp.o newProgramFrame.o Project2_private.res -o "Project2.exe" -L"G:/Program Files/wxDev-Cpp/lib" -mwindows -lwxmsw25 -lwxmsw25_gl -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lopengl32 -lodbc32 -Os -s
Normaly, with MFC for example or pure WIN32 API this kind of application should take about 50 KB.
I would like to know if this is normal and if it is not, which I hope, where is my mistake and how can I produce a smaller executable ?
Thanks !!
a little better
Hi, with the better optimization of UPX I got 533 KB.
other option ?
other option ?
Hi there,
That may not be a pleasant surprise, but yes, it's normal.
There's no way you'll ever get a 50 Kb executable by linking it with a library with the size of wxWidgets statically. If you plan on making several programs with wxWidgets, link dynamically instead. Even so, your example might still be about 100 Kb, in which case, you can try UPX, but I doubt it will help that much there.
The downside of this, however, is having to supply your users with the DLL... but hey, most MFC-based program installations also do this.
In any case, g++ is know for making slightly larger executables than most compilers, so don't expect it to compete with cl in that aspect.
Good luck in your future experiments with wxWidgets
That may not be a pleasant surprise, but yes, it's normal.
There's no way you'll ever get a 50 Kb executable by linking it with a library with the size of wxWidgets statically. If you plan on making several programs with wxWidgets, link dynamically instead. Even so, your example might still be about 100 Kb, in which case, you can try UPX, but I doubt it will help that much there.
The downside of this, however, is having to supply your users with the DLL... but hey, most MFC-based program installations also do this.
In any case, g++ is know for making slightly larger executables than most compilers, so don't expect it to compete with cl in that aspect.
Good luck in your future experiments with wxWidgets
Hi!
The size of the executables is one of the biggest disadvantages of wxWidgets... But that is quite a common problem: With Qt you'll have to ship separate DLLs, with Java you'll even have to install a whole runtime environment (like .NET). What you get is a cool cross-platform, easy portable lib.
True, but MS has the advantage that they can ship the DLLs with their OSThe downside of this, however, is having to supply your users with the DLL... but hey, most MFC-based program installations also do this.
The size of the executables is one of the biggest disadvantages of wxWidgets... But that is quite a common problem: With Qt you'll have to ship separate DLLs, with Java you'll even have to install a whole runtime environment (like .NET). What you get is a cool cross-platform, easy portable lib.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
thanks
OK guys !
Thanks for all your reply, I see better how the things works now in wxWidgets. I think I will do it with dynamic sharing and in M$ I will compile with their compiler VC++ and I'll use UPX.
Limbrus
Thanks for all your reply, I see better how the things works now in wxWidgets. I think I will do it with dynamic sharing and in M$ I will compile with their compiler VC++ and I'll use UPX.
Limbrus
-
- Earned a small fee
- Posts: 23
- Joined: Wed Oct 20, 2004 5:07 pm
I get normally with wxDev-Cpp 2.04MB files (when comiling something small) and with UPX i get ~500kb files.
--- http://linkku.has.it ---
- Debian Etch, KDevelop3, Anjuta2, wxWidgets CVS, GCC 3.3
- Windows XP, wxDevCpp, wxWidgets 2.6.1
- Debian Etch, KDevelop3, Anjuta2, wxWidgets CVS, GCC 3.3
- Windows XP, wxDevCpp, wxWidgets 2.6.1
-
- Earned a small fee
- Posts: 23
- Joined: Wed Oct 20, 2004 5:07 pm
Hi!
2. You didn't strip the executable.
What version of Dev-C++ did you use? I suppose it was an older version that used gcc 2.9.5. This gcc version produced smaller app than the new gcc 3.3.1.
1. You left debugging on.wait... before I found wxDevCpp I build a program with the "normal" dev-cpp (just a simple one) and it was -after stripping- ~900kb! how comes that a progam with similar functionality compiled with wxDevCpp is 3.5mb?
2. You didn't strip the executable.
What version of Dev-C++ did you use? I suppose it was an older version that used gcc 2.9.5. This gcc version produced smaller app than the new gcc 3.3.1.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda