February 13, 2009

Cedet + Qt

On one of the Russian forums I was asked "Why Cedet doesn't work with Qt?" Answer is very simple - it works, but you need to make simple customization. Add following code into your initialization file, and Cedet begin to parse your code:
(add-to-list 'auto-mode-alist
'("/usr/include/qt4" . c++-mode))
(semantic-add-system-include 
"/usr/include/qt4" 'c++-mode)
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
"/usr/include/qt4/Qt/qconfig.h")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
"/usr/include/qt4/Qt/qconfig-dist.h")
Here is proof:
Emacs + Cedet + Qt
Thanks to Eric M. Ludlam for hint about semantic-lex-c-preprocessor-symbol-file variable.
Update (12/05/2009): It seems, that this approach will not work in fresh CEDET - I'm working on fix

4 comments:

John Connors said...

Thanks for these posts. CEDET was a complete mystery to me before but now I can see it is a really useful thing. Looking forward to Emacs 24.

Anonymous said...

Could you kindly post all the relevant sections of your .emacs file that enables context sensitive help for Qt on emacs. I do have all the cedet, semantic and cogre packages installed on Debian/Lenny but cant get it to work with Qt.

SwordGreen said...

Thank you for your great post!
But why does my emacs say "Symbol's value as variable is void: semantic-lex-c-preprocessor-symbol-file"?

Could you give me any help? Thank you very much!

Alex Ott said...

It seems, that CEDET wasn't compiled properly. Please, take CEDET from CVS and compile according instructions