farfromfearless

Using wxFormBuilder with Code::Blocks on Mandriva 2009

After some puzzling I found out how to setup a nice development environment with wxFormBuilder and Code::Blocks on Mandriva Linux 2009. How to do this is described below.

Packages

Download and install the following packages and it’s dependencies:

  • Code::Blocks
  • libwxgtku2.8
  • libwxgtku2.8-devel
  • wxGTK2.8

wxFormBuilder

Download the wxFormBuilder 3.0 linux source including the pre-generated Makefiles. Now unpack the tarball, build and install wxFormBuilder:

  • cd /usr/local/src/
  • wget or fetch wxformbuilder-3.0.57.tar.gz
  • tar -zxvf wxformbuilder-3.0.57.tar.gz
  • cd wxformbuilder_3.0.57
  • make CONFIG=Release
  • ./install/linux/wxfb_export.sh /usr

Code::Blocks

  • Start Code::Blocks and open the menu Tools -> Configure tools…
  • Click on Add.
  • The following picture shows how to setup the tool:

  • Save the settings and open the menu File -> New -> Project
  • Choose wxWidgets project
  • Walk trough the wizard
  • Use wxWidgets 2.8.x
  • Preferred GUI Builder: wxFormBuilder
  • Application type: Frame Based
  • Use the default widgets configuration

When you would like to modify your GUI you can open the following menu: Tools -> wxFB. Which will launch wxFormBuilder with your GUI. When it asks for conversion, click yes.

Don’t forget to generate the code (press F8) before you switch back to Code::Blocks. Otherwise you changes won’t be visible. You also need to build your project in Code::Blocks before your changes are visible.

In certain versions and combinations of the software the following compile error could occur: “wxMessageBox was not declared in this scope”. There are two solutions to this problem:

1) I noticed wxFormBuilder changed a bit. All headers where included in the generated code, even when the headers were not necessary. Now not all the headers are included. When you use other wxWidgets methods just add the proper header. In this case you can use the following include:

#include <wx/msgdlg.h>

2) Do not use the Code::Blocks wxWidgets template and just setup a clean C::B project. Then also setup a clean wxFormBuilder project by using the inherited class tutorial (*). Finally add the code manually to the project.

Links

No comments as yet.

Anonymous - Gravatar

No comments have yet been made to this posting.

Commentors on this Post-

Leave a Comment-

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs are automatically generated. Off-topic or inappropriate comments will be edited or deleted. Email addresses will never be published. Keep it PG-13 people!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

All fields marked with "*" are required.