Compiling wxWidgets 2.9.0 in Visual C++ 2010 Express

Warning! Some information on this page is older than 5 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

# Compiling wxWidgets 2.9.0 in Visual C++ 2010 Express

Thu
06
May 2010

NEW! (2011-02-18) I posted this entry months ago, wxWidgets keeps evolving and so it may no longer work. For building wxWidgets 2.9.1 in Visual C++ 2010, I now recommend you follow steps described here: Visual Studio C++ 2010 - Microsoft Visual C++ Guide - wiki.wxwidgets.org and here: Fixed wxWidgets 2.9.1 project files Visual Studio 2010 - forums.wxwidgets.org.

My old blog entry:

Today I wanted to compile wxWidgets library (version 2.9.0, which contains lots of interesting new features, including wxPropertyGrid control) under Visual C++ 2010 Express. A strange error appeared that stopped the build and explained nothing specific about the cause:

Microsoft.CppCommon.targets(151,5): error MSB6001: Invalid command line switch for "cmd.exe". The path is not of a legal form.

It took me some time to find a correct solution on Google, as many of them didn't work. (Copy setup.h file to some another directory? Made no difference in my case. Use the wx.dsw - project file for oldest IDE version? Didn't work either, my Visual says it cannot import such projects.)

Finally I've found this forum topic: http://forums.wxwidgets.org/viewtopic.php?t=27630. Sami Hamlaoui on 25th April 2010 posted a ZIP archive there containing converted and fixed project for Visual C++ 2010 that you can download and use to successfully build wxWidgets 2.9.0. Thanks for that!

After you build all projects in Debug and Release configuration, you just need to setup include and library paths in the IDE:

...\wxWidgets-2.9.0\include
...\wxWidgets-2.9.0\include\msvc

...\wxWidgets-2.9.0\lib\vc_lib

And finally you can use wxWidgets in your projects. To do that, you need to #include files such as and link with these libraries:

comctl32.lib, rpcrt4.lib, winmm.lib, advapi32.lib, wsock32.lib

and desired wx libraries like wxbase29ud.lib and wxmsw29ud_core.lib ("d" is for debug, use versions without "d" in Release configuration). Also remember that the new wxWidgets has no ASCII support, so you have to use Unicode character set.

Comments | #wxwidgets #visual studio Share

Comments

STAT NO AD
[Stat] [STAT NO AD] [Download] [Dropbox] [pub] [Mirror] [Privacy policy]
Copyright © 2004-2019