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. Qt Creator, #define and syntax highlighting
Qt 6.11 is out! See what's new in the release blog

Qt Creator, #define and syntax highlighting

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.9k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    tony
    wrote on last edited by
    #1

    Hi all,

    I'd like to show you a strange visual effect that I have in Qt Creator.

    To simplify the process of declaring methods exported in a DLL, I've coded some #defines, like the following ones:

    @
    #define APIEXPORT __declspec(dllexport)
    #define APICALLMETHOD __stdcall

    #define DECLARE_FUNC0(fName) int APIEXPORT APICALLMETHOD fName(void)
    #define DECLARE_FUNC1(fName, param1) int APIEXPORT APICALLMETHOD fName(param1)
    #define DECLARE_FUNC2(fName, param1, param2) int APIEXPORT APICALLMETHOD fName(param1, param2)
    @

    so, I use them in my code:

    @
    DECLARE_FUNC0(funcA)
    {
    ...
    }

    DECLARE_FUNC1(funcB, int)
    {
    ...
    }
    @

    Only for DECLARE_FUNC0, syntax highlighting in the body goes away. Or better, keywords like "new", "if", etc. are highlighted properly, but custom types (i.e. boost::mutex) or class members are not highlighted.

    DECLARE_FUNC1, 2, ... work fine.

    Does anybody has a scientific, or even magical, explanation??? :)

    Thanks,
    Tony.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Which version of Qt Creator are you using?

      There was quite a bit of work on the C preprocessor recently, to make it handle defines better, so maybe the issue is already fixed in master:-) Unfortunately this change also introduced some regressions which are currently getting ironed out.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tony
        wrote on last edited by
        #3

        Hi Tobias,

        I'm using the latest one, 2.5.0 RC. Anyway, even with latest stable one (2.4.1, if I'm not wrong) it doesn't work.

        T.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          I was referring to new code in the master branch. Both 2.4.1 and 2.5 were branched of from master before this change landed, so the code is in neither of those.

          It would be great if you could take a look at the master branch and tell me if it works there, but unfortunately nightly builds are still not there AFAIK, so that would require a bit of compiling:-( Sorry for the inconvenience, somebody is working on that.

          Of course you can also wait for 2.6beta in a couple of month.

          1 Reply Last reply
          0

          • Login

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