How to let QtCreator to HELP code "#include" ?
-
I would like this forum to engage in discussion on HOW to utilize QtCreator to logically code #include. Yes, I mean real discussion, not just "...you been told before...' etc.
I am NOT asking how to utilize "DOS" symbols such as "..//.."
Here is a starting point
When QtCreator builds project - it ends up with .pro /.cpp/.h .ui files in specific project directory.The "head" of .cpp will usually contain "header file " ... #include (,,,,,).h
Here is an example:
#include "mainwindow_Terminal_ORIGINAL.h" #include "ui_mainwindow_Terminal_ORIGINAL.h" #include "console.h" #include "settingsdialog.h" #include <QLabel> #include <QMessageBox>
The subject of discussion would be
#include "mainwindow_Terminal_ORIGINAL.h"The crude analysis is - the header file is on SAME level of project directory structure.
And it can be verified by OBSERVING
From here things are not that clear
The "subproject" terminal is TEMPLATE = lib hence SAME header file HAS to be included in subproject where such library is used.
( Adding actual library may be beneficial in this discussion,,
but I like NOT to muddle the water with more "what if" for now )And that is not so intuitive by just looking at "Project: view.
The incorrect/ missing "#include" has a direct result - this error :make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/terminal_Bluetooth' /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23 mainwindow.o: in function `MainWindow::menu_slot_indexed(int)': mainwindow.cpp:(.text+0x72ba): undefined reference to `MainWindow_TERMINAL_ORIGINAL::MainWindow_TERMINAL_ORIGINAL(QWidget*)' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: Leaving directory '/mnt/A_BT_DEC10/BT__PROGRAMS/A_MAR7_MAR15/A_BT_LIBRARY/mdi' make[1]: *** [Makefile:293: mdi] Error 1 make: *** [Makefile:621: sub----A_BT_LIBRARY-mdi-make_first] Error 2 10:11:04: The process "/usr/bin/make" exited with code 2. Error while building/deploying project A_Mar7_MAR17 (kit: Qt 5.15.2 (gcc_64)) When executing step "Make"
The error DOES NOT show the actual source code of error (?) but it can be observed in
"Show in editor "
MainWindow_TERMINAL_ORIGINAL *MWTO = new MainWindow_TERMINAL_ORIGINAL(); add_mdi_subwindow(MWTO ); MainWindow_Bluetooth *MWB = new MainWindow_Bluetooth(); add_mdi_subwindow(MWB ); break;
hence I consider " Show in editor" ONE of the helping tools of QtCreatror.
The other "tools " is "Include hierarchy " view, BUT that is unclear how to utilize this tool to CORRECT and add the missing #include.
The last , very useful tool is "intelisense" but it is NOT intuitive since it "Includes" many entries of SAME directory or actual files.
So
back to the title
How to let QtCreator to HELP #include
sub-project library header ?PS
"worst case scenario" is to look for "properties" of the #include header and add FULL PATH to such file...PPS
Appreciate your help to clear this confusing mess of tools and find the most logical way to "do it right" on first trial.Actually - old fashioned "flow chart" to
How to let QTCreator to HELP #include ?
would be very nice.