I have been using Code::Blocks since I started programming in C, after trying every C compiler in existence under windows I found Code::Blocks the most easiest to work with beca
THESE DETAILS MAY NOT APPLY TO ANY VERSION OF CODE::BLOCKS OTHER THAN 17.12
I had the same problem with Code::Blocks 17.12 on Ubuntu 16.04
As per the answer above, the solution (for me) was to modify the GTK Wizard script, but this is a little different than described, perhaps because of differing Code::Blocks versions.
Code::Blocks -> New -> Project -> right-click 'GTK+ Project' -> select 'Edit this script'
Code::Blocks will now display a script in an editor pane. But this script is locked. It also is not saved anywhere.
Save the file Code::Blocks -> File -> Save
The file will be saved to ~/.local/share/codeblocks/templates/wizard/gtk as wizard.script
Close this file in Code::Blocks (click the 'x' in the editor pane tab)
Open the file using some other editor (vi(m), Geany, whatever...)
Near the base of the file are the lines...
project.AddCompilerOption(_T("`pkg-config gtk+-2.0 --cflags`"));
project.AddLinkerOption(_T("`pkg-config gtk+-2.0 --libs`"));
Either comment these out and add two new lines or modify the lines as follows
project.AddCompilerOption(_T("`pkg-config gtk+-3.0 --cflags`"));
project.AddLinkerOption(_T("`pkg-config gtk+-3.0 --libs`"));
Note 'gtk+-2.0' has been altered to 'gtk+-3.0' in both lines
Start Code::Blocks and create a NEW project. This should now compile.
Note: GTK3 projects created previously will NOT compile.
Note: The Code::Blocks New -> Project -> GTK+ Wizard icon will now display in RED. This indicates that the GTK+ project wizard script has been modified.