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 in ui_mainwindow.h
Forum Updated to NodeBB v4.3 + New Features

Cannot open include file in ui_mainwindow.h

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 9.6k 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.
  • F Offline
    F Offline
    fzec
    wrote on last edited by
    #1

    I am making a project in QT Creator 2.6. I am promoting a QWidget subclass called cPlotter, but when I try to compile the project, it fails because it cannot find the file cplotter.h. I figured out that this is because the file "ui_mainwindow.h" updates automatically including the file cplotter.h within brackets instead of quotes.

    So, ui_mainwindow.h updates like:

    #include <cplotter.h>

    but it should be:

    #include "cplotter.h"

    So, it is very annoying to edit by hand every time I change something on the GUI.

    Anyone knows a solution for this?

    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AttilaPethe
      wrote on last edited by
      #2

      Why do not include it yourself in mainwindow.h which is processed BEFORE ui_mainwindow.h? Anyway ui_mainwindow.h has not to be edited only in a very desperate situation... Sometimes avoiding the graphical designer is a better idea like edit ui_mainwindow.h. Best regards!

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on last edited by
        #3

        The "ui_mainwindow.h" was designed NOT to be edited by hand since it is generated by designer based from the UI files.

        This "thread":http://stackoverflow.com/questions/4907766/promoting-widgets-in-qt-creator may help you in promoting your widgets. AFAIK, you can promote widgets from the designer and not from editing the "ui_*" files.

        Edit at your own risk!

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fzec
          wrote on last edited by
          #4

          [quote author="AttilaPethe" date="1354485794"]Why do not include it yourself in mainwindow.h which is processed BEFORE ui_mainwindow.h? Anyway ui_mainwindow.h has not to be edited only in a very desperate situation... Sometimes avoiding the graphical designer is a better idea like edit ui_mainwindow.h. Best regards![/quote]

          I did what you say, but it does not work, since the line #include <cplotter.h> keeps being generated, so that the compiler does not find the file at that point. Thank you anyway !

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AttilaPethe
            wrote on last edited by
            #5

            If we read about your problem in n869 specification (google for it as "N869 standard"):

            bq. 6.10.2 Source file inclusion

            Constraints

            [#1] A #include directive shall identify a header or source
            file that can be processed by the implementation.

            Semantics

            [#2] A preprocessing directive of the form

            include <h-char-sequence> new-line

            searches a sequence of implementation-defined places for a
            header identified uniquely by the specified sequence between
            the < and > delimiters, and causes the replacement of that
            directive by the entire contents of the header. How the
            places are specified or the header identified is
            implementation-defined.

            [#3] A preprocessing directive of the form

            include "q-char-sequence" new-line

            causes the replacement of that directive by the entire
            contents of the source file identified by the specified
            sequence between the " delimiters. The named source file is
            searched for in an implementation-defined manner. If this
            search is not supported, or if the search fails, the
            directive is reprocessed as if it read

            include <h-char-sequence> new-line

            with the identical contained sequence (including >
            characters, if any) from the original directive.

            To summarize, #include "xyz" directives cause the preprocessor to search
            in an implementation-defined manner for the source file indicated. If
            this fails, it tries again using the search method that it normally uses
            for #include <xyz> directives (which is also implementation-defined).
            Another (sort of) important difference is that #include <xyz> directives
            need not specify an actual source file - the implementation defines how
            it determines what text is used to replace the directive.

            So in conclusion you steel can do things in mainwindow.h and even in project.pro files I think...

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fzec
              wrote on last edited by
              #6

              [quote author="Code_ReaQtor" date="1354497123"]The "ui_mainwindow.h" was designed NOT to be edited by hand since it is generated by designer based from the UI files.

              This "thread":http://stackoverflow.com/questions/4907766/promoting-widgets-in-qt-creator may help you in promoting your widgets. AFAIK, you can promote widgets from the designer and not from editing the "ui_*" files.

              Edit at your own risk![/quote]

              I followed that Stackoverflow thread, but what they say did not work for me. Also, I know that the file is not intended to be edited by hand, but it is my "solution" in the meantime.

              Thanks anyway.

              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