Difference between revisions of "Compiling wxWidgets with MSYS-MinGW"

From WxWiki
Jump to navigation Jump to search
m
Line 12: Line 12:
 
**C:/MinGWStudio/MinGW /mingw
 
**C:/MinGWStudio/MinGW /mingw
 
**Note the forward slashes!
 
**Note the forward slashes!
**Rename the file to fstab (with no file extension). If you have file extensions hidden (the Windows default) then you have to turn them on. In Widows explorer go to Tools->folder options. Click on the view tab and turn off 'hide extensions for known file types'
+
**Rename the file to fstab (with no file extension). If you have file extensions hidden (the Windows default) then you have to turn them on. In Windows explorer go to Tools->folder options. Click on the view tab and turn off 'hide extensions for known file types'
  
 
*If you haven't set up your paths, now is a good time to do it. Here is how you do it in Windows XP. Right click on my computer then select Properties. Click on the advanced tab then the 'environment variables' button. In system variables, look for a variable called path and double click on it. Add the following to the beginning of the value.  
 
*If you haven't set up your paths, now is a good time to do it. Here is how you do it in Windows XP. Right click on my computer then select Properties. Click on the advanced tab then the 'environment variables' button. In system variables, look for a variable called path and double click on it. Add the following to the beginning of the value.  

Revision as of 17:00, 10 June 2006

Compiling wxWidgets with MSYS/MinGW

MSYS/MinGW provide a very minimal unix-like environment for Windows, not requiring Cygwin.

  • First, install MinGW from http://www.mingw.org/download.shtml. If you're using Dev-C++, this was probably already done for you.
  • Download MSYS from http://www.mingw.org/download.shtml
  • Install it by running the installer application.
    • During the post-install procedure, you'll be asked where MinGW is installed. This is the directory containing the `bin/' directory with MinGW files. So if the location of mingw is C:/Dev-Cpp/bin or C:/MinGW/bin, be sure to only give the C:/Dev-Cpp or C:/MinGW portion. The postinstall script only gives you one shot at this so try to get it right the first time. Note the forward slashes.
    • If you didn't install MinGW in the root directory the install will fail to find it. In that case you have to manually tell msys where to find MinGW. Go to c:\msys\1.0\etc (change the path to suit your installation) and create a new text file. Open it and add the following line:
    • c:/mingw /mingw
    • Replace c:/mingw with your path. In my case it becomes:
    • C:/MinGWStudio/MinGW /mingw
    • Note the forward slashes!
    • Rename the file to fstab (with no file extension). If you have file extensions hidden (the Windows default) then you have to turn them on. In Windows explorer go to Tools->folder options. Click on the view tab and turn off 'hide extensions for known file types'
  • If you haven't set up your paths, now is a good time to do it. Here is how you do it in Windows XP. Right click on my computer then select Properties. Click on the advanced tab then the 'environment variables' button. In system variables, look for a variable called path and double click on it. Add the following to the beginning of the value.
    • c:\mingw\bin;c:\msys\1.0\bin;
    • You will probably have to change these values to suit your installation. For instance mine is
    • C:\MinGWStudio\MinGW;c:\msys\1.0\bin;
    • Note the back slashes! Don't delete the exisitng paths unless you know what you are doing. Make sure msys is AFTER the mingw path.
  • To achieve this in Windows 98 and ME, go to Start/Run and type msconfig. There is a tab called Environment where you can modify the paths and other variables.
  • Download the wxWidgets source from http://www.wxwidgets.org/downld2.htm . Find a version relevant to you (I prefer the non-setup version).
  • Extract the file to somewhere helpful (C:\wx seems like a good choice, or maybe C:\wx241, or likewise).
  • Open an MSYS shell by clicking on the Msys icon.
    • change to the directory you installed the wx source to ( $ cd c:wx ).
    • create a new build directory ($ mkdir msw-debug ) call it what you like.
    • enter that directory ( $ cd msw-debug ).
    • run configure to 'configure' your custom built wxWidgets. Don't forget to add your special flags for anything else you want to turn on or off. ( $ ../configure --disable-shared --enable-debug )
    • make your wx ( $ make ).
    • install it into MSYS. This will be helpful for running the 'wx-config' script later ( $ make install ).
    • test your build. If you see a windows application open up, your wxWidgets has built correctly ( $ cd samples/minimal; make && minimal.exe ).

Problems with MinGW 3.2

%3.2 If having problems with "include/wx/msw/missing.h", try replacing with the version in Cvs. %%

Problems with MinGW 3.1

%3.1 (thanks to Abhijeet Bhonge for this): To build under mingw 3.1 you would have to do following:

msw/dialup.cpp, Line 860:

    put (void*) cast in front of wxRasDialFunc
       

msw/fontenum.cpp, Line 161:

    change wxFONTENUMPROC cast to FONTENUMPROC

common/dynlib.cpp, Line 332:

    put (void*) cast in front of call to wxDllGetSymbol()

This should compile everything properly. If you get strange missing references while linking samples, especially about wxDataObject, you may also have to add -D__GNUC__=3 to OPTIONS in line 102 in src/makeg95.env. (It seems that the gcc 3.1 compiler is not setting this macro correctly & as a result some code is not included in the compiled library.) In case gcc complains of duplicate definition, remove this. I am not sure whether every installation of gcc > 3 has this problem or whether it's just me. %%