Results 1 to 5 of 5

Thread: C++ code syntax highlight

  1. #1

    Default C++ code syntax highlight

    Hi,

    I just upgrade QT 5.0.1 to 5.1. However, I found the source file (.cpp) are not highlighted. After further investigation, I found the #include statement is required to point to the exact path. For example, the directory looks like:
    project root
    |-- inc
    | |-- aa.h
    | `-- bb.h
    `-- src
    |-- aa.cpp
    `-- bb.cpp

    The include statement need to be "#include <inc/aa.h>" so that bb.cpp is highlighted. But for previous version, "#include <aa.h>" is fine.
    So my question is how I can still just include the header file only without the path".

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: C++ code syntax highlight

    Does your project file contain any INCLUDEPATH statements? Did it contain any when you were using 5.0.2?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: C++ code syntax highlight

    Quote Originally Posted by wysota View Post
    Does your project file contain any INCLUDEPATH statements? Did it contain any when you were using 5.0.2?
    I think it does not.

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt

    SOURCES += \
    src/aa.cpp \
    src/bb.cpp

    HEADERS += \
    inc/aa.h \
    inc/bb.h

    For previous version, I just add existing file. Then the source file is highlighted.
    For 5.1, I tried to open existing qt project file that there is no highlight.
    So I tried create a new project and add existing files. However, the result is the same.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: C++ code syntax highlight

    If it doesn't then how the IDE (or the compiler itself) is supposed to know where to look for your files? If you add "inc" to INCLUDEPATH then Creator will know where to look for your files.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5

    Default Re: C++ code syntax highlight

    Thanks. It works.

Similar Threads

  1. QRegExp for syntax highlight
    By UVV in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2011, 20:54
  2. Syntax Highlighting for CUDA Code
    By jiddoo in forum Qt Tools
    Replies: 1
    Last Post: 14th April 2010, 09:50
  3. QListWidget syntax highlight
    By Ken_Afford in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 15:54
  4. Syntax highlight selection problem
    By s.toonen in forum Qt Programming
    Replies: 9
    Last Post: 4th June 2008, 12:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.