Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Disable “The build directory needs to be at the same level as the source directory” warning in Qt Creator
QtWS25 Last Chance

Disable “The build directory needs to be at the same level as the source directory” warning in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 3.4k 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
    Donald Duck
    wrote on last edited by Donald Duck
    #1

    I have a Qt project located in the folder C:\Users\donaldduck\OneDrive\Documents\myproject, and I want to have the build directory as a subfolder of the source directory, at C:\Users\donaldduck\OneDrive\Documents\myproject\build-myproject. The problem is that Qt Creator gives me a warning saying "The build directory needs to be at the same level as the source directory":

    enter image description here

    Other than this warning, the project compiles just fine. I don't even get any problems that the build directory is a subfolder of the source directory. I searched on the web to see why I get this warning, and I found that it's probably because not having the build directory at the same level as the source directory could cause problems with relative paths. But I don't have any relative paths in my program, I have all of the files in a QRC resource.

    So this error is just annoying, and I would like to disable it. I've searched the web for a solution, but haven't found anything.

    Also, I only get this warning on my Windows computer and on my Mac virtual machine. I have a similar folder structure (the build directory is a subfolder of the source directory) on my Linux virtual machine, but none of them give any warning. Also, before I updated Qt on Windows, I didn't get that warning, but since I updated it I've been getting this warning on Windows also.

    How can I disable this warning?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      patrik08
      wrote on last edited by
      #2

      Mac inside virtual host its like a fish outside water....
      try to put this 3 variable in your profile... hidden is better like .o
      MOC_DIR = o
      RCC_DIR = o
      OBJECTS_DIR = o

      D 1 Reply Last reply
      0
      • P patrik08

        Mac inside virtual host its like a fish outside water....
        try to put this 3 variable in your profile... hidden is better like .o
        MOC_DIR = o
        RCC_DIR = o
        OBJECTS_DIR = o

        D Offline
        D Offline
        Donald Duck
        wrote on last edited by
        #3

        @patrik08 I tried that and I still get the warning.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          patrik08
          wrote on last edited by
          #4

          and build from source normal... if its go normal on
          qmake && make
          the problem is on qtcreator setting project...
          i dont trust virtual box...

          D 1 Reply Last reply
          0
          • P patrik08

            and build from source normal... if its go normal on
            qmake && make
            the problem is on qtcreator setting project...
            i dont trust virtual box...

            D Offline
            D Offline
            Donald Duck
            wrote on last edited by
            #5

            @patrik08 Forget about VirtualBox. I tested your code on Windows (not a virtual machine) by writing the code in the pro file, running QMake and compiling it. It still gave the warning and besides it put the executable in a folder called build-myproject\o instead of the build-myproject\release folder (I'm using Visual Studio compiler which creates subfolders of the build directory called "debug" or "release").

            1 Reply Last reply
            0
            • P Offline
              P Offline
              patrik08
              wrote on last edited by
              #6

              Haha.. lol.. i never use visual st.. only the free MinGW ...
              i remember me 25 years a go i read Microsoft Frontpage book 500 pages.... my mind go crazy...
              also write i pro file
              OBJECTS_DIR = release

              1 Reply Last reply
              0
              • aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                the reason for this warning is, that qmake may have problems if the build dir is below the source dir (i.e. not at the same hierarchy). there was some work on qmake which improved (but not fully solved qmakes restriction). therefore, some creator version removed the warning and some later reintroduced it.

                Qt has to stay free or it will die.

                1 Reply Last reply
                1
                • P Offline
                  P Offline
                  patrik08
                  wrote on last edited by
                  #8

                  normaly i use pri file... to include..
                  after file can stay on other disk or 4 level down ... its not important... only $$PWD/ say how to find file... same level or not...

                  # Input
                  HEADERS += $$PWD/rtf-qt/TextDocumentRtfOutput.h \
                             $$PWD/rtf-qt/AbstractRtfOutput.h \
                             $$PWD/rtf-qt/AuthorPcdataDestination.h \
                             $$PWD/rtf-qt/CategoryPcdataDestination.h \
                             $$PWD/rtf-qt/ColorTableDestination.h \
                             $$PWD/rtf-qt/CommentPcdataDestination.h \
                             $$PWD/rtf-qt/CompanyPcdataDestination.h \
                             $$PWD/rtf-qt/controlword.h \
                  
                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi
                    Its not possible to disable this warning at present time.
                    https://bugreports.qt.io/browse/QTCREATORBUG-16616

                    1 Reply Last reply
                    2

                    • Login

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