Preprocessor and parsing

Nicolás Alvarez nicolas.alvarez at
Fri Feb 6 18:42:08 UTC 2015

2015-02-06 14:29 GMT-03:00 Shashank Chintalagiri <shashank at>:
> Hi,
> I've recently been trying to use kdevelop to build some embedded code, and
> seem to have run into a rather trying glitch.
> A lot of the code, both within the header files and libraries that I intend
> to use and the code that I intend to write, depends heavily on preprocessor
> directives - most importantly the -mmcu compiler flag and the directives it
> generates. In the absence of this directive, the preprocessor dumps out of
> most of the header files because it doesn't know which processor it should
> set up the defines for.
> Some very old posts on the internets suggested that kdevelop 3.x did, at
> some point, have the ability to add extra preprocessor directives to the
> parser. Try as I might, I can't find anything like that on 4.6.0, which
> makes using kdevelop for this disturbing.
> So here's what I would like to know / request :
> * Is there a way to specify custom preprocessor defines for the parser in
> kdevelop? During the build cmake provides the necessary flags to the
> compiler and the build works fine - I just need to be able to set some
> relatively sane default during development to make autocomplete and
> crossreferencing work within the editor and kdevelop.

Only way I can think of would involve editing kdevelop's code.

> * Is there any way in which kdevelop's parser announces itself to the
> preprocessor? While not ideal (since it'll probably need to go into multiple
> files), it should be fundamentally sufficient if I could do something like :
> #define __MSP4305529__ (or what have you)
> #endif
> This would allow the code to compile fine while being compatible with the
> IDE.

The macro is called "IN_KDEVELOP_PARSER".


More information about the KDevelop-devel mailing list