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. Cannot open include file: ui_*.h when using multiple Qt projects in the same Visual Studios solution
QtWS25 Last Chance

Cannot open include file: ui_*.h when using multiple Qt projects in the same Visual Studios solution

Scheduled Pinned Locked Moved Unsolved General and Desktop
windowsx64visual studioui header
4 Posts 2 Posters 1.2k 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.
  • A Offline
    A Offline
    Armaan Bandali
    wrote on last edited by
    #1

    I'm trying to use a header file from one Qt project that includes the associated ui_myDialog.h file in a different Qt project in the same solution. The project that has this header file creates the ui_myDialog.h file successfully and builds fine, but when I try to use this header file in the other project, it is unable to build and gives me fatal error C1083: Cannot open include file: 'ui_myDialog.h': No such file or directory. Any help or insights with this issue would be much appreciated. Thank you.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Since the file is generated it's not in the source but in the build dir. So either include this directory or better forward declare the Ui::Dialog class und use a pointer to it (Ui::Dialog *m_ui) so you don't need to include the generated ui header file in your header at all.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Armaan Bandali
        wrote on last edited by
        #3

        Thank you very much for your help. I included the build directory and set the project dependencies accordingly. This fixed the issue.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          My second solution would be much more portable.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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