Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QTCreator using wrong defines for syntax highlighting

QTCreator using wrong defines for syntax highlighting

Scheduled Pinned Locked Moved Qt Creator and other tools
qtcreator
2 Posts 2 Posters 784 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JimDuchek
    wrote on last edited by
    #1

    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.

    Thanks,

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      Zargontapel
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved