Search This Blog

Sunday, September 21, 2008

CodeLite - IDE for C

For my C projects I was using Notepad++ as my editor/IDE for some time. Although notepad++ is good, it is lacking the integration with a code browser, source control and debugger.
I came to know about CodeLite when I was searching for ctags for windows. It has integrated Subversion, ctags, gdb under one roof.

Since it is multiplatform GUI, I was little reluctant to install and try(I have tried lot of multiplatform GUI applications and never satisfied with the look and feel of them). But wxWidgets makes the CodeLite to look like native windows application.

CodeLite has lot of features and it looks very similar to VC++ IDE.

Code browsing is very easy with CodeLite. It is has a very light explorer and also workspace view through which you can browse your project “easily”. You can switch between header and c file “easily” using the “Swap Header/implementation file” in the context menu. Context menus “Goto declaration” and “Goto Implementation” are handy to browse through code quickly.

If you are using cygwin and custom makefile - you can use a script as custom build command - see http://samueldotj.blogspot.com/2007/10/notepad-as-ide.html for more details.

I use the following command to build(because I use gcc cross compiler)
c:\cygwin\bin\bash -l -c 'cd $ACE_ROOT/src;PATH=/usr/cross/i586-elf/bin/:$PATH:;make 2> err; sed -e "s@\(\/cygdrive\/\)\([a-zA-Z]\)@\2:@g" err; rm err’. And the following command to clean
c:\cygwin\bin\bash -l -c 'cd $ACE_ROOT/src;PATH=/usr/cross/i586-elf/bin/:$PATH:;make clean’

Codelite supports debugging through gdb; embedded and remote targets also supported. Since I am using a emulator to test my kernel, I have to use remote debugging in GDB to test my OS. Codelite integrates well with GDB remote debugging. I use the following GDB commands as startup gdb commands.

set print pretty on
directory src/kernel 
symbol obj/kernel.sys
source img/gdb/general.gdb
source img/gdb/stack.gdb
source img/gdb/vm.gdb

If SVN is configured, using codelite you can see difference between two versions of a same file. By default codelite uses the default diff viewer. It can be changed from Plugins menu -> Subversion->Options and setting the value appropriately. I use WinMerge to see differnece of source files and have the following settings:
External Diff viewer: C:\Program Files\WinMerge\WinMergeU.exe
Arguments : /dl %bname /dr %mname %base %mine 

Another good thing about CodeLite is still under development and your bug report/feature requests are solved within short time frame.

You can download CodeLite from www.codelite.org. It has installer for Windows and Linux also.

4 comments:

Anonymous said...

Congrats for setting CodeLite with native window$ feel ! I'm new to codelite and have a small doubt to ask you. I build my project with the command line "g++ -o program program.cpp `additional arguments` " in terminal, how could I do the same in CodeLite? Thanks in advance.

Unknown said...

Right click on the project in "Workspace view", then select "Settings"->Compiler->"Compiler options"->Type your additional options.

Anonymous said...

Thank you :)

Karan said...

I m trying to browse linux code using codelite. For some reason, i am finding it difficult to include the source files in the editor.