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. uic + CMake + GCC + custom widgets + out-of-source problem

uic + CMake + GCC + custom widgets + out-of-source problem

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
cmakeuicheadercustom widgetcustom widgets
12 Posts 3 Posters 2.7k 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.
  • SGaistS SGaist

    Hi and welcome to devnet,

    From the looks of it your forgot to enable CMAKE_AUTOUIC.

    See here.

    S Offline
    S Offline
    stan423321
    wrote on last edited by
    #3

    @SGaist Thank you for your assistance.
    Firstly, adding the three lines setting those global variables does not eliminate the error in question.
    Secondly, do they change anything given the following line was already present?

    set_target_properties(minitest PROPERTIES AUTOUIC ON AUTOMOC ON AUTORCC ON)
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      stan423321
      wrote on last edited by
      #4

      I've just realized that the error message would probably be helpful.

      In file included from (scrubbed)/min-s/main.cpp:1:
      (scrubbed)/min-m/minitest_autogen/include/ui_ui.h:15:10: fatal error: betterbutton.h: No such file or directory
         15 | #include "betterbutton.h"
            |          ^~~~~~~~~~~~~~~~
      compilation terminated.
      
      
      jsulmJ 1 Reply Last reply
      0
      • S stan423321

        I've just realized that the error message would probably be helpful.

        In file included from (scrubbed)/min-s/main.cpp:1:
        (scrubbed)/min-m/minitest_autogen/include/ui_ui.h:15:10: fatal error: betterbutton.h: No such file or directory
           15 | #include "betterbutton.h"
              |          ^~~~~~~~~~~~~~~~
        compilation terminated.
        
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #5

        @stan423321 said in uic + CMake + GCC + custom widgets + out-of-source problem:

        betterbutton.h

        Where is it located?

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stan423321
          wrote on last edited by
          #6

          All 4 files described in opening post are in the min-s directory. Next to it there's a min-m directory where I build it.

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

            You don't seem to add the directory to the include search paths.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stan423321
              wrote on last edited by
              #8

              Is that the standard practice for working with .ui files? It doesn't seem right to me, this breaks the separation of system headers and project ones. Also, I can't help but wonder why MSVC wouldn't need this...

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #9

                I am not sure to follow your question here.

                You told us that you have files in subdirectories but yet you do not provide the necessary include paths for the compiler to find the headers in your sub folder.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  stan423321
                  wrote on last edited by
                  #10

                  Well, if I include them from .cpp files, both GCC and MSVC automatically know to look in the folder with the source file. I have never before used the include path for in-project files, all the advice I have followed before recommended using include paths just for libraries (e.g. Qt). Not to mention, in a more complex setup, it would break relative paths.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    It depends all on how you write your includes in your code.

                    cmake provides the CMAKE_INCLUDE_CURRENT_DIR variable so you can ensure that your project folder is used for the includes.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stan423321
                      wrote on last edited by
                      #12

                      Well, huh. I thought I tried that one with the bigger project before, but it does work with the test program here, so that must have been something else. Thank you for your assistance.

                      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