QTCreator using wrong defines for syntax highlighting
JimDuchek last edited by
Hello. I'm using qtcreator 3.4.2. My session has several projects in it, some of which share source files. There are #ifdef's in my source, and these defines are set in the .pro file for each project. Everything compiles and works swimmingly, with the exception of syntax highlighting for #ifdef/#ifndef/etc. QtCreator uses, by default, the defines for the first project only. I can go to tools->c++->'additional preprocessor directives' and change which project's defines to use, but it only changes that specific source file -- it seems to me that QtCreator should be automatically using preprocessor defines from whichever my active project currently is, i shouldn't have to tell it file-by-file, and manually switch them every time I switch projects.
Is there a configuration setting on this that I'm unaware of? This isn't a deal-breaker but it's pretty annoying as 'unused code' does not get syntax highlighting or completion or any of that.
Zargontapel last edited by
This topic is quite old, but for any future time-travelers coming by this way, I found a workaround, that works at least in my case.
My projects is structured as a SUBDIRS project, with all the subprojects listed in the main .pro file. In each subproject file, I "include(PARENT_PROJECT.pro)", on the very first line. Moving this include statement to the bottom of the subproject's .pro file fixed the QtCreator syntax highlighting issue for me. Hopefully this helps someone, somewhere out there.