How to port my Linux WX app to Windows?
How to port my Linux WX app to Windows?
I have an OpenGL WX app in Linux. How to port it to Windows?
Thanks.
Thanks.
- T-Rex
- Moderator
- Posts: 1249
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
If your project doesn't contain platform-specific code then you should just create new project using MS VC++ Express (which is free) or wxDev-CPP or othe IDE for Windows, add all your source code to this project (http://forums.wxwidgets.org/viewtopic.php?t=255) and it should work.
Also if you have platform-specific code then you should use #ifdef
#ifdef __WXGTK__
// GTK-specific code
#else
// e.g. Win32-specific code
#endif
Also if you have platform-specific code then you should use #ifdef
#ifdef __WXGTK__
// GTK-specific code
#else
// e.g. Win32-specific code
#endif
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact:
Like priyank_bolia said, you will need to link the widget libraries ("install them") to compile on Windows. You will not need them to run the executable. So if you distribute the EXE to anyone else, they will not need wxWidgets at all to run it.kornerr wrote:Thanks, T-Rex.
One more question. Will my ported app be dependend on wx lib? I.e. will I be able to run it on Windows without wx installed?
Thanks.
As for how to link them it depends on your compiler but I believe there are a number of tutorials around the wxWidgets homepage and probably these forums for different compilers. I've only had experience with Visual C++ but for that at least wxWidgets provides a pre-made project file that I just have to open up and build. It's pretty simple (though setting up the environments for my apps is not quite as easy ).
22MB sounds wrong though. I don't know what you did there but the files shouldn't be that large unless your app is absolutely massive (which at 150k on Linux it shouldn't be). That could also be an issue with MinGW, I've never used it myself.
-
- Super wx Problem Solver
- Posts: 424
- Joined: Tue Jul 12, 2005 8:44 pm
- Location: Alabama, USA
There are a lot of tips around for reducing the size of executable files built with wxWidgets. Just search the forum or the web...
In your case, you're most likely linking with wxWidgets as a shared library under linux and a static library under Windows. This means that all of the wxWidgets code will be linked with your Windows app. You can also build the wxWidgets libraries as shared libraries and simply place them in your application folder when you distribute the app. This means the user doesn't have to install wxWidgets separately and your executable will be much smaller. However, you then have the extra size of the wxWidgets DLLs. It's really up to you...
Mingw generally produces much larger executable files than the Microsoft or Borland compilers. I'd say you could work with Mingw until you're ready to release your app, and then get the free Visual C++ Express to compile the release version.
-Scott
In your case, you're most likely linking with wxWidgets as a shared library under linux and a static library under Windows. This means that all of the wxWidgets code will be linked with your Windows app. You can also build the wxWidgets libraries as shared libraries and simply place them in your application folder when you distribute the app. This means the user doesn't have to install wxWidgets separately and your executable will be much smaller. However, you then have the extra size of the wxWidgets DLLs. It's really up to you...
Mingw generally produces much larger executable files than the Microsoft or Borland compilers. I'd say you could work with Mingw until you're ready to release your app, and then get the free Visual C++ Express to compile the release version.
-Scott
- T-Rex
- Moderator
- Posts: 1249
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Well, It seems that you have Debug build of your wxWidgets binaries. That's why your executable size is ~22Mb. You should use Release build (which is also far more faster).
150Kb under Linux.... it seems that you compiled wxWidgets with --enable-shared flag. In this case your application should not work on other Linux machines if the do not have wxWidgets runtime installed. (E.g. to I had to download binary version of wxWidgets to make MinGWStudio work under Ubuntu Linux because it seems that MinGWStudio was built with shared version of libs)
150Kb under Linux.... it seems that you compiled wxWidgets with --enable-shared flag. In this case your application should not work on other Linux machines if the do not have wxWidgets runtime installed. (E.g. to I had to download binary version of wxWidgets to make MinGWStudio work under Ubuntu Linux because it seems that MinGWStudio was built with shared version of libs)
Yeah, that sounds about right. Though Release version should be about half the size of Debug in my experience (though this is with MSVC++). I believe there are also other programs out there that will shrink the size of your executable some more. I've seen a few topics around these boards about that I think.
-
- Can't get richer than this
- Posts: 802
- Joined: Mon Dec 27, 2004 10:46 am
- Location: Estonia, Tallinn
- Contact:
I get about 2.2MB binaries out of MSVC6 after the std::iostreams are used by default in wx.
This packed with UPX is below 800KB. Used to get 550KB with MSVC6 - haven't tried mingw32 and packing the resulting binaries of it with UPX.
In other words, check out UPX if you already haven't
This packed with UPX is below 800KB. Used to get 550KB with MSVC6 - haven't tried mingw32 and packing the resulting binaries of it with UPX.
In other words, check out UPX if you already haven't
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
OS's: Gentoo Linux, WinXP; WX: CVS HEAD
Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/