- Download the appropriate MSYS2 installer for your architecture from http://www.msys2.org/. I am using a 64-bit ark so all the steps from here on out would all refer to 64-bit MSYS2/MinGW. After installing, check the SYSTEM PATH if the path to {MSYS INSTALL DIR}\ming64\bin is present. If not, then add it to the SYSTEM PATH. If the GCC toolchain is not yet installed, open the MSYS command prompt and then type pacman -S mingw-w64-x86_64-gcc.
- Open the MSYS command prompt and install the packages mingw-w64-i686-make and mingw-w64-x86_64-make using the command pacman -S mingw-w64-i686-make mingw-w64-x86_64-make
- After the package installation, add {MSYS INSTALL DIR}\ming32\bin to SYSTEM PATH. This is to allow you to use the mingw32-make command.
- Head over to the downloads page of wxWidgets over here http://www.wxwidgets.org/downloads/ and download the Windows Installer (~47 MB). The wxWidgets site provides a Windows installer that only installs the source code.
- Run the installer and take note of location of the installation. In my case, I installed it at C:\wx.
- Create a new Windows environment variable by going to System->Advanced system settings->System Properties->Environment Variables. Name the new environment variable as WXWIN and set its value to the directory where wxWidgets is installed (eg. C:\wx).
- Open DOS command line window (cmd.exe, *not* Bash sh.exe) directory to %WXWIN%\build\msw.
- We need to compile the DEBUG build and the RELEASE build. In my current installation. There is a problem with compiling wxWidgets 3.1.0 with the recent GCC version pertaining to the declaration multiple definitions so you need to pass the --allow-multiple-definition to LD when compiling.
- In the DOS command line window that you opened in Step 7, start compiling for RELEASE build by entering: mingw32-make -j4 -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release MONOLITHIC=1 LDFLAGS=-Wl,--allow-multiple-definition
- If the compilation is successful, start compiling for the DEBUG build by entering: mingw32-make -j4 -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug MONOLITHIC=1 LDFLAGS=-Wl,--allow-multiple-definition
- If all's well, you can now let CodeLite use wxWidgets by adding gcc_dll folder in the Windows Environment path located at %WXWIN%\lib\gcc_dll.
Saturday, February 4, 2017
Compiling and Installing wxWidgets 3.1.0 with MSYS2/MinGW in Windows 10
I am using CodeLite to try to learn C++ programming and eventually some GUI programming using wxWidgets and wxCrafter. To work with CodeLite and wxWidgets, wxWidgets needs to be compiled first. There are a couple of ways to compile wxWidgets. One is to compile using VisualStudio, and the other is by using GCC. The CodeLite wiki suggests using TDM-GCC to compile wxWidgets. I've tried using TDM-GCC but didn't work for me. However, I should have noted that the CodeLite wiki could be referring to an earlier version of wxWidgets and GCC, so there might be incompatibilities. Reading through the installation steps provided with the wxWidgets source code, I managed some success in compiling and using wxWidgets with the MSYS/MinGW GCC toolchain. Here are the steps that I did to compile and use wxWidgets 3.1.0 in Windows 10
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment