Code::Blocks is a complete, cross-platform integrated development environment for C and C++, built using the wxWidgets toolkit. Code::Blocks is available on Linux, Windows and OS X, so you may find it useful on Linux if you switched and are already used to it or an IDE like Dev-C++, for example.
The last stable version is 8.02, and was released almost an year ago. Since Code::Blocks is not included in the Debian repositories, I will show in this tutorial how to compile and install it from source in Lenny, the upcoming stable Debian release. Just follow the steps below:
1. Download the source and uncompress it
Download the source code from the official website, here, then make sure to switch the current directory to the one where you saved the source and uncompress it using the following command:
tar -xjf codeblocks-8.02-src.tar.bz2
2. Install the needed dependencies
This should be easy since only a few dependencies are needed. First, make sure you have the build-essential meta-package installed, which contains tools like make or g++, needed for compilation:
su
apt-get install build-essential
Next, install the development packages needed by Code::Blocks:
su
apt-get install wx-common libwxgtk2.8-dev libgtk2.0-dev
You will also need package zip to build it:
apt-get install zip
3. Update wx-config to point to wxWidgets 2.8
Issue the following command as root:
update-alternatives --config wx-config
What appears should look something like this:
# update-alternatives --config wx-config
There are 4 alternatives which provide `wx-config'.
Selection Alternative -----------------------------------------------
1 /usr/lib/wx/config/base-unicode-release-2.6 +
2 /usr/lib/wx/config/gtk2-unicode-release-2.6
3 /usr/lib/wx/config/base-unicode-release-2.8
* 4 /usr/lib/wx/config/gtk2-unicode-release-2.8
Press enter to keep the default[*], or type selection number:
4 Using '/usr/lib/wx/config/gtk2-unicode-release-2.8' to provide 'wx-config'.
Select option 4 from the list, that is /usr/lib/wx/config/gtk2-unicode-release-2.8
4. Compile from source and install
Make sure the working directory is the uncompressed source of Code::Blocks (codeblocks-8.02) and issue the usual commands:
./configure
make
make install
The last one as root.
5. Run ldconfig as root
Finally, run the ldconfig utility as root to update the links to shared libraries:
su
ldconfig
Code::Blocks should be now properly installed in /usr/local/bin/ and you can run it using codeblocks from a terminal or from a run dialogue (ALT+F2 and type codeblocks in KDE and GNOME).
Related articles
Compiling C/C++ Code in Ubuntu and Available IDEs
Running Google Chrome Under Wine 1.1.6 in Debian
Create a Launcher in KDE3
9 comments:
Just tried it, you also need:
apt-get install zip
to build codeblocks-8.02.
You should first attempt to install it from your distribution's package repository. For example, I ran the Fedora 10 package installer, and Code::Blocks 8.02 is available. Just select, and install.
Anonymous @ 12:26 - It seems to work fine for me without the package zip installed.
Anonymous @ 15:33 - Agree, but in this case I mentioned Code::Blocks is not available in the Debian repositories. Probably other distributions (like Fedora, as you point out) include it in theirs. I think Ubuntu 8.10 comes with it too, but never checked that out (or maybe it's going to be in Jaunty Jackalope?)
Anyway, thanks for the feedback guys!
Actually after issuing make again, you were right :) It needs zip to compile.
/bin/sh: zip: command not found
make[4]: *** [manager_resources.zip] Error 127
I'll modify the tutorial accordingly. I had the package zip installed when compiling it, so I didn't notice this error message, but now to verify I removed it. Thanks!
Awesome 'how-to'!! Thanks so much. I'm a newb to linux altogether and I've been having such a hard time with all this stuff... but you made it easy! Thanks so much - Nate
thanks for the guide!
it helped me a LOT!
Thanks!!!
works perfectly, I've tried it on lenny...
quick and easy.
Alvaro
I followed your guide. configure worked, but make bombed on my system running ubuntu 9.10.
======================================
======================================
g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include/wxscintilla/include -I../../src/include -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/wxFlatNotebook/include -I../../src/src/wxAUI -DENABLE_BINRELOC -DAPP_PREFIX="\"/usr/local\"" -Ulinux -Uunix -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT prefix.o -MD -MP -MF .deps/prefix.Tpo -c -o prefix.o prefix.cpp
prefix.cpp: In function ‘char* br_extract_dir(const char*)’:
prefix.cpp:396: error: invalid conversion from ‘const char*’ to ‘char*’
prefix.cpp: In function ‘char* br_extract_prefix(const char*)’:
prefix.cpp:432: error: invalid conversion from ‘const char*’ to ‘char*’
make[3]: *** [prefix.o] Error 1
make[3]: Leaving directory `/opt/codeblocks-8.02/src/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/codeblocks-8.02/src/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/codeblocks-8.02/src'
make: *** [all-recursive] Error 1
======================================
======================================
any suggestions?
Cordially,
Really? Why, I haven't compiled anything in the last 6 months or so and even before I didn't need to learn, I compiled stuff because I wanted to learn how. Acai Max Cleanse
Post a Comment