Code::Blocks

From WxWiki
Jump to: navigation, search

(For a more up-to-date guide, please see CodeBlocks Setup Guide.)

Code::Blocks 10.05

Build wxWidgets if you haven't already done this.

cd wxWidgets (or whatever the folder with the source is called)
mkdir buildGTK
cd buildGTK
../configure
make

We'll use the minimal project from the samples folder.

cd samples/minimal
make

How to create a wxWidget sample app using CodeBlocks

  • create an empty wxWidget project with the wizard
  • right click the project in the management pane
  1. chose "Properties"
  2. check "This is a custom makefile"
  3. verify the makefiles-name (should be 'Makefile' in this case)
  4. make sure the execution folder point to where the makefile is
  5. close the "Properties" dialog

Note: path should be under the buildgtk folder i.e ../wxWidgets/buildgtk/samples/minimal

  • right click the project in the management pane
  1. chose "Build options"
  2. open the "Make commands" tab (rightmost)
  3. fix the make commands (most likely need to remove '$target')
  4. close the dialog
  • right click the project in the management pane
  1. click "Add files" or "Add files recursively"
  2. add the files you want to your project
  • right click on project properties
  1. select "Build targets" tab
  2. correct execution working folder to point to location of binary
  3. correct output filename field to contain either a relative path or absolute path with filename
  • save your project (via menu, context menu or ALT+SHIFT+S)


You should be able to build, run and debug the minimal sample app using CB.

Code::Blocks 8.02

This one is pretty simple and worked almost out of the box assuming that you already have set up wxWidgets and confirmed its function by typing wx-config --libs in a terminal. If it lists its libraries its working, if its spitting an error it, obviously, is not.


Create a new project, choose wxWidgets project.

Then go to Project -> Build options and replace whatever the wizard generated in both, Debug and Release -> Compiler settings -> Other options with

`wx-config --cxxflags`

and Debug/Release -> Linker settings -> Other linker options with

`wx-config --libs`

You can also set your global settings to use this. You can do this by going to Settings -> Compiler and Debugger and doing the configuration there. This way you don't have to reconfigure every single project you do.

Code::Blocks SVN Version

This one is pretty simple and worked almost out of the box assuming that you already have set up wxWidgets and confirmed its function by typing wx-config --libs in a terminal. If it lists its libraries its working, if its spitting an error it, obviously, is not.


Create a new project, choose wxWidgets project.

Then go to Project -> Build options and replace whatever the wizard generated in both, Debug and Release -> Compiler settings -> Other options with

`wx-config --cflags`

and Debug/Release -> Linker settings -> Other linker options with

`wx-config --libs`

You should be all set now :)