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. Visual Studio C++ basic project cannot open source file "ui_DialogGui.h
QtWS25 Last Chance

Visual Studio C++ basic project cannot open source file "ui_DialogGui.h

Scheduled Pinned Locked Moved Solved General and Desktop
visual studio ccompiler errorgui
6 Posts 2 Posters 21.8k 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.
  • T Offline
    T Offline
    Tamis2018
    wrote on last edited by
    #1
    1. Just basic project on MSVC++ 2017. I created simple QT Gui application then I added on Form Files new QT GUI class with name DialogGui, and try to compile. It is not possible to compile:

    here is the message from Visual C++ compiler.
    Severity Code Description Project File Line Suppression State
    Error (active) E1696 cannot open source file "ui_DialogGui.h" ... \DialogGui.h 4

    What is ui_DialogGui.h? Where it is located? I try through google to find some help. Here is what I have found:

    https://stackoverflow.com/questions/19711564/qt-5-migration-cannot-open-include-file-ui-mainwindow-h

    Basically it points out to:

    "I had the same problem; solved cleaning the project (From Qt->Build) and adding:
    SET(CMAKE_INCLUDE_CURRENT_DIR ON)"
    the problem is that I could not find:

    --CMakeListsbolded text.txt file for Visual C++ projects.

    It seems to me that problem might be with setting up include path in Visual C++, but where is located ui_DialogGui.h?

    jsulmJ 1 Reply Last reply
    0
    • T Tamis2018
      1. Just basic project on MSVC++ 2017. I created simple QT Gui application then I added on Form Files new QT GUI class with name DialogGui, and try to compile. It is not possible to compile:

      here is the message from Visual C++ compiler.
      Severity Code Description Project File Line Suppression State
      Error (active) E1696 cannot open source file "ui_DialogGui.h" ... \DialogGui.h 4

      What is ui_DialogGui.h? Where it is located? I try through google to find some help. Here is what I have found:

      https://stackoverflow.com/questions/19711564/qt-5-migration-cannot-open-include-file-ui-mainwindow-h

      Basically it points out to:

      "I had the same problem; solved cleaning the project (From Qt->Build) and adding:
      SET(CMAKE_INCLUDE_CURRENT_DIR ON)"
      the problem is that I could not find:

      --CMakeListsbolded text.txt file for Visual C++ projects.

      It seems to me that problem might be with setting up include path in Visual C++, but where is located ui_DialogGui.h?

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

      @Tamis2018 ui_DialogGui.h is a header file which will be generated by the moc tool (see http://doc.qt.io/qt-5/moc.html for more information). Do you use the Qt plug-in for Visual Studio?

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

      T 1 Reply Last reply
      3
      • jsulmJ jsulm

        @Tamis2018 ui_DialogGui.h is a header file which will be generated by the moc tool (see http://doc.qt.io/qt-5/moc.html for more information). Do you use the Qt plug-in for Visual Studio?

        T Offline
        T Offline
        Tamis2018
        wrote on last edited by
        #3

        @jsulm I believe that is the problem:
        0_1530706078953_bc7859a5-fea4-40d0-9a57-0af553281c87-image.png

        and that seems to be problem...

        0_1530706234725_6f9a361c-c0eb-439b-bf8a-73b6cbcbe0af-image.png

        well, where QT include files are found?
        I could not see where include from qt is comming from?

        0_1530706467386_4d6e5e6d-1b2f-44ec-b1c6-a06c8f908ae1-image.png

        That is more or less what you might need to know where I am...
        Here is what I have followed when I installed that qt with Visual C++ 2017

        T 1 Reply Last reply
        1
        • T Tamis2018

          @jsulm I believe that is the problem:
          0_1530706078953_bc7859a5-fea4-40d0-9a57-0af553281c87-image.png

          and that seems to be problem...

          0_1530706234725_6f9a361c-c0eb-439b-bf8a-73b6cbcbe0af-image.png

          well, where QT include files are found?
          I could not see where include from qt is comming from?

          0_1530706467386_4d6e5e6d-1b2f-44ec-b1c6-a06c8f908ae1-image.png

          That is more or less what you might need to know where I am...
          Here is what I have followed when I installed that qt with Visual C++ 2017

          T Offline
          T Offline
          Tamis2018
          wrote on last edited by
          #4

          I have forgotten to note that these there buttons are not visible to my code neither Mybotton is visible on Form of QTdesigner,

          0_1530706967266_f7faeae8-83ec-4e04-b9e5-914c7182fa29-image.png …

          jsulmJ 1 Reply Last reply
          0
          • T Tamis2018

            I have forgotten to note that these there buttons are not visible to my code neither Mybotton is visible on Form of QTdesigner,

            0_1530706967266_f7faeae8-83ec-4e04-b9e5-914c7182fa29-image.png …

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

            @Tamis2018 So your app now compiles and runs?
            Mybutton is not visible in QtDesigner because you create it in your code manually - QtDesigner does not know anything about it.
            The other 3 buttons are visible in your code. You need to access them through ui->BUTTON_NAME. All UI elements handled by QtDesigner are accessible in code via ui pointer (ui->). Take a look at https://doc-snapshots.qt.io/qt5-5.9/designer-using-a-ui-file.html#

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

            T 1 Reply Last reply
            3
            • jsulmJ jsulm

              @Tamis2018 So your app now compiles and runs?
              Mybutton is not visible in QtDesigner because you create it in your code manually - QtDesigner does not know anything about it.
              The other 3 buttons are visible in your code. You need to access them through ui->BUTTON_NAME. All UI elements handled by QtDesigner are accessible in code via ui pointer (ui->). Take a look at https://doc-snapshots.qt.io/qt5-5.9/designer-using-a-ui-file.html#

              T Offline
              T Offline
              Tamis2018
              wrote on last edited by
              #6

              Everything is correct. I have reinstalled and these three buttons are
              done by as you already stated. Thanks! It was two reasons.
              THANKS!!!

              1 Reply Last reply
              1

              • Login

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