Cygwin
From WxWiki
Contents |
[edit] To set up wxWidgets using Cygwin
- install Cygwin. In addition to the default, you will need to select the following packages:
- cvs
- gcc-g++
- make
- login then check out wxMSW (anonymous password is anoncvs):
cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets login cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout wxMSW
- if compiling the cvs head fails, you should have better success with an older release:
cvs -d :pserver:anoncvs@cvs.wxwidgets.org:/pack/cvsroots/wxwidgets checkout -r WX_2_8_BRANCH wxMSW
- cd wxWidgets and run the configure script with the desired parameters. Example:
./configure --with-msw --enable-debug --enable-debug_gdb --disable-shared
- If compiling fails with "[wxtiff_tif_jpeg.o] Error 1", use the built-in jpeg support. Example:
./configure --with-msw --enable-debug --enable-debug_gdb --disable-shared --with-libjpeg=builtin
- you may have to fix dependencies by running again setup.exe of Cygwin and installing the missing packages.
- make
NOTE: If you don't configure with "--disable-shared", you will be unable to compile contrib libraries.
NOTE2: Make sure the path to wxWidget directory doesn't contain a space or the make will fail.
[edit] To get an executable independent of Cygwin DLL
Normally if you compile with Cygwin's GCC, any executables you create will depend on the Cygwin DLL, forcing you to distribute your application with the DLL. There is, however, a workaround. Including -mno-cygwin in CFLAGS/LDFLAGS in configure.in makes Cygwin's GCC compile and link against only native windows libs. Compiling wxWidgets apps with this option has been reported to work flawlessly - at least for wxWidgets 2.6.2. See http://www.delorie.com/howto/cygwin/mno-cygwin-howto.html for more information. See also the warning in the configure.in comments about mno-cygwin and the math library.
- 2.2.9
- If you're using 2.2.9 with cygwin, you'll have to change line 184 of the file 'src/jpeg/jmorecfg.h' from 'typedef long int INT32;' to 'typedef int INT32;'.
- 2.8.0
- To remove all traces of cygwin-dependence, I had to do the following (assuming you are building under bash)
- export CFLAGS=-mno-cygwin
- export CPPFLAGS=-mno-cygwin
- export CXXFLAGS=-mno-cygwin
- export LDFLAGS="-mno-cygwin -mwindows"
- ./configure --build=i686-pc-mingw32 --disable-precomp-headers --without-expat
- Note that you might be able to omit some of the above command-line options, as they were related to my particular version of cygwin (1.5.23-2) and gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
- make
- make samples
[edit] To test your installation
- Fetch this HelloWorld example here and save it as hworld.cpp in directory ~/hworld
- Now compile and link it in one step:
cd ~/hworld g++ -o hworld hworld.cpp `../wxWidgets/wx-config --cxxflags --libs --debug=yes`
- Test the executable:
./hworld.exe
[edit] To generate Win32 applications rather than console apps
Include the linker flag '-mwindows' to produce a Win32 app, i.e. one which doesn't pop up a console as well as your GUI. If you are using a configure script, this can be achieved with 'export LDFLAGS=-mwindows' before you run configure.
