Porting wxWidgets apps developed with Visual C++ to other OS

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Nishal
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Apr 17, 2013 10:01 am

Porting wxWidgets apps developed with Visual C++ to other OS

Post by Nishal »

I don't know if this is the right category to ask this question.

Well, i've been developing wxWidgets apps on windows using mingw compiler and code::blocks IDE(wxSmith).

I was reading some comparison between c++ compilers online and somewhere I read that MinGW(or they might have mentioned GCC instead of MinGW. I do not remember exactly) is a slow compiler. And I do feel that it is slow(I don't know if the speed will increase with Visual C++). So, I was planning to switch to visual c++ compiler with wxWidgets. But I'm worried that if I do, in future, if I would want to port my code to linux/mac, I would not be able to do so.

1. So will I be able to port my wxWidgets code to linux/mac, if I use visual C++???

2. Also, if I switch my compiler, should I re-compiler wxWidgets???

3. If I switch my IDE from wxwidgets to visual studio/wxFormBuilder, will I still be able to port my projects to linux/mac without changing code much???

Thank you.
beneficii
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Nov 27, 2009 2:49 am

Re: Porting wxWidgets apps developed with Visual C++ to othe

Post by beneficii »

In answer to your questions:

1.) Yes, if you make sure to not put in your code VC++-specific features such as #pragma or any OS-specific features, but instead let wxWidgets completely wrap around the API.

2.) Yes, you will need to re-compile wxWidgets. I'm assuming you're using Visual Studio 2013. Open up build/msw in your wxWidgets folder and run wx_vc10.sln. Tell it yes that you want to upgrade all the project files to the current version, and then compile wxWidgets for each mode you want, like Debug | Win32, Debug | x64, Release | Win32, Release | x64. (Note: I have received an error returned from CMD.EXE when compiling the release builds, but the Release builds clearly compiled as they should have.) You can go to samples/minimal and try to build minimal_vc9.vcxproj, producing a new .sln file. You can try compiling it and running it to test that it works.

3.) Yes, provided that you do not us the specific VC++ features or directly access the Windows API, but let wxWidgets do the wrapping for you and do all of your graphics interfacing through wxWidgets. wxWidgets was designed to be as portable as possible when you use its classes and functions. Changing the compiler you use to VC++ by itself won't change that. Also, wxFormBuilder is available across multiple systems, including not just Windows, but Linux and Mac and others, too.

BTW, assuming you're using Visual Studio 2013 for Desktop, here are some templates you can put them (DO NOT UNZIP) in My Documents\Visual Studio 2013\Templates\ProjectTemplates, which would allow you to minimally build wxWidgets programs. Be sure to go to My Computer, right click, select properties, select Advanced Options, select Environmental Variables, and add a new variable named WXWIN, and set it to the directory (without the trailing backslash (\)) that is your main wxWidgets folder. WXWIN being set like this would allow you to use the templates below to link with wxWidgets libraries and include wxWidgets header files. The minimal libraries are provided for this: You will need to add the more advanced libraries for certain things, like wxXmlDocument or wxDataViewListCtrl.
Attachments
wxWidgets 3.0.0 Application.zip
Application with AppMain source and header
(4.34 KiB) Downloaded 126 times
wxWidgets 3.0.0 Application Empty.zip
Empty application
(3.75 KiB) Downloaded 119 times
Nishal
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Apr 17, 2013 10:01 am

Re: Porting wxWidgets apps developed with Visual C++ to othe

Post by Nishal »

Thank you very much for that reply. That would help a lot.

By the way, can you post a list of VC++ specific commands(or give a link to a page containing that).
beneficii
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Nov 27, 2009 2:49 am

Re: Porting wxWidgets apps developed with Visual C++ to othe

Post by beneficii »

Nishal wrote:Thank you very much for that reply. That would help a lot.

By the way, can you post a list of VC++ specific commands(or give a link to a page containing that).
You would just open up the wx_vc10.sln in the build\msw folder of your wxWidgets directory, say yes to upgrade it, and then build wxWidgets for each mode, like Debug | Win32, Release | Win32, Debug | x64, and Release | x64. (Note that CMD.exe returns an error code for the Release builds, but the Release builds will still work. At least for me it did that.)
Post Reply