Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding search directory in Qt IDE
Qt 6.12 LTS is out! See what's new in the release blog

Adding search directory in Qt IDE

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 959 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I would like to add a very long path directly into my Qt project, so that I don't have to write something like:

    @#include "C:\dir1\dir2\dir3\dir4\dir5\dir6\dir7\dir8\my_header.hpp"@

    Can this be done using QTIDE?

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      This has nothing to do with Qt Creator. You need to add your header to INCLUDEPATH in you .pro file (if you are using qmake):
      @
      INCLUDEPATH+=C:/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
      @

      Then, in your source file:
      @
      #include "my_header.hpp"
      @

      On a related note, don't use absolute paths in your source code! Make them relative to your project's root directory. Otherwise your code will not be useful on other machines.

      (Z(:^

      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
      • Unsolved