Cannot open include file in ui_mainwindow.h
-
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.
-
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!
-
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 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 !
-
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 readinclude <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...
-
[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.