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: checking syntax & highlighting
Forum Updated to NodeBB v4.3 + New Features

Qt Creator: checking syntax & highlighting

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 2 Posters 1.1k 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.
  • D Offline
    D Offline
    dimv36
    wrote on last edited by
    #1

    Hello, guys.

    I use QtCreator for editiing pure-C code. In those code I have some statements, which exist in pure-C, but exist in C++, e.g.:

    namespace is not keyword in C, but it's keyword in C++.

    At this place QtCreator check code and tells me, that I have a syntax error in this place, e.g.

    const char *namespace
    

    Does any way exist in QtCreator to set list of keywords, that must be checked by QtCreator and will be highlighted?

    jsulmJ 1 Reply Last reply
    0
    • D dimv36

      Hello, guys.

      I use QtCreator for editiing pure-C code. In those code I have some statements, which exist in pure-C, but exist in C++, e.g.:

      namespace is not keyword in C, but it's keyword in C++.

      At this place QtCreator check code and tells me, that I have a syntax error in this place, e.g.

      const char *namespace
      

      Does any way exist in QtCreator to set list of keywords, that must be checked by QtCreator and will be highlighted?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @dimv36 Just an assumption: what are the file extensions for your C code? *.c, *.cc?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      0
      • jsulmJ jsulm

        @dimv36 Just an assumption: what are the file extensions for your C code? *.c, *.cc?

        D Offline
        D Offline
        dimv36
        wrote on last edited by
        #3

        @jsulm I have *.c files as source code and *.h as headers.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dimv36
          wrote on last edited by
          #4

          I just answered on my questions myself.

          QtCreator has Keywords.cpp file located at src/libs/cplusplus/Keywords.cpp
          In those file QtCreator check given word and determine it's type (keyword as this, namespace of identifier).

          So, I comment code, which checks not-pure-C keywords, make those lib and install to qtcreator/lib/ directory. It works for me.

          1 Reply Last reply
          1
          • D Offline
            D Offline
            dimv36
            wrote on last edited by
            #5

            As for me, it will be great, If I can choose type of code to check (e.g. Pure-C, Pure-C++ or Qt), so, is QtCreator has any pluggable mechanism to do that?

            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