Using wXWidgets in ecplise

To create a wXWidgets project in eclipse, first create a new "Managed make C++ project" as usual. Then

  • Make sure the main project folder is selected in the C/C++ Projects view.

  • Select Project / Properties from the menu.

  • Select C/C++ Build.

  • Under Configuration, make sure it shows the configuration you want to work with. In most cases, this is "debug". If you change that to "Release" then you have to do these things over again.

  • Make sure the "Tool Settings" tab is selected.

  • Under GCC C++ Compiler, select "Miscellaneous"

  • Where it says "other flags" there is already a "-c -fmessage-length=0". After that, add a space and add all the compile settings (use cut'n'paste!).

  • Under GCC C++ Linker, select "Miscellaneous"

  • Where it says "Linker flags" add all the build setting flags.

  • Go to GCC C++ Linker, directly.

  • In the Box where it says "Expert Settings: Command Line Pattern" you will have something like:

    ${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

    If you don't have the expert settings box, then your CDT version is to old. Please update to at least 3.0.2 or newer.

    You need to change that to have ${FLAGS} as the last in the list, like this:

    ${COMMAND} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}

    Please make sure you add spaces where they should be and don't add spaces where they should not be.

  • On Mac OS X you will also have to create an application bundle.

    Switch to the tab "Build Steps"

    For Post-Build Step, add the following (in one line and with the ; in the middle):

    mkdir -p ${BuildArtifactFileName}.app/Contents/MacOS ; 
    mv ${BuildArtifactFileName} ${BuildArtifactFileName}.app/Contents/MacOS/

    After you compile, use Finder to execute your new application

  • On some Mac OS X versions (PowerPC) there is a bug in g++ 4.0 (noted in 4.0.1, build 5243), which is the default compiler. If you get strange linker errors, try the following:

    • under GCC C++ Compiler set Command to g++-3.3 (instead of g++)

    • under MacOS X C++ Linker set Command to g++-3.3 (instead of g++)

    • make sure you recompile everything (Project / Clean, then rebuild)

  • On Mac OS X with XCode 2.2 the g++ compiler (gcc 4.0.1 build 5243) has a bug that prevents it from linking. In this case, under "GCC C++ Compiler" and "GCC C++ Linker" you will need to set the command to "g++-3.3" to use the older (bug free) version of gcc.

  • Click "Ok". Your project is now configured for wxWidgets.