QLineEdit: No such file or directory. However, other projects find it just fine.
-
Using Mageia Linux 7 and Qt Creator 4.9.0 based on Qt 5.12.6 (GCC 8.3.1 20190412, 64 bit).
I have a weird problem that started when I cloned a Mercurial repository on to a new machine and compiled.
It's telling me QLineEdit doesn't exist when it does. I can create a new project and it works fine.
In desperation I ended up copying the source code off my original machine rather than going via Mercurial and started deleting stuff.
Now, this project is a very old (ten years) and originally the build must have been done inside the source directory. There were loads of moc_ files, ui_ files and .o files that aren't in Mercurial, but were in the original directory. These days I have external build directories, but I'd just never got round to deleting all that old info.
I deleted, from the source directory, all the moc_ files, then the ui_ and all was well. When I deleted all the .o files, I had the issue. Restored them, all and it compiled and ran fine. Each time I clean, run qmake and rebuild.
So, I have worked out I get this error when I delete rwLineEdit.o from the source directory:
/path/rwLineEdit.h:4: error: QLineEdit: No such file or directory
#include <QLineEdit>When you start typing in QLine... it autocompletes the header name. It's definitely there.
Can anyone think why a seemingly irrelevant object file in the source directory would cause this issue? rwLineEdit.o gets recreated in the build directory.
I appreciate I will have likely done something shockingly bad, I am no C++ programmer, more of an embedded engineer, so it's likely I've made a real schoolboy error somewhere. Edit: I have created many Qt programs over the years; I'm not a total noob, but this is something I dabble in rather than it being my main thing,
If there's any other info that would be useful, I'm happy to supply.
-
-
Yup. This project is very old and has been running for ten years. I would have thought it wouldn't program on any machine without that. Also, all the other widgets are found just fine. It's just that one #include in that one file.
rwLineEdit is a custom widget. Could that be any sort of pointer to the issue?
.pro for completeness sake.
# ------------------------------------------------- # Project created by QtCreator 2010-02-18T09:46:39 # ------------------------------------------------- QT += sql QT += core gui printsupport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets # qt3support TARGET = sqlforms TEMPLATE = app LIBS += -lrwlineeditplugin \ -lrwtexteditplugin \ INCLUDEPATH += ../customWidgets/rwLineEdit/ RESOURCES += sqlforms.qrc SOURCES += main.cpp \ login_dialogue.cpp \ sqlforms.cpp \ ../shared_classes/rw_sql_utilities.cpp \ form.cpp \ partslist.cpp \ component_locations.cpp \ invoices_in.cpp \ calender_dialogue.cpp \ enter_invoice_in.cpp \ add_supplier.cpp \ retrieve_supplier.cpp \ table_dialogue.cpp \ invoices_in_filtering.cpp \ invoice_in_dialogue.cpp \ payments_out.cpp \ rwDateEdit.cpp \ payments_out_recalled.cpp \ payments_out_dialogue.cpp \ pcb_entry.cpp \ import_csv.cpp \ order_code_entry.cpp \ component_entry.cpp \ warning_dialogue.cpp \ purchase_order.cpp \ user.cpp \ purchase_order_recall.cpp \ import_bom.cpp \ csv_import.cpp \ component_usage.cpp \ invoice_out.cpp \ invoice_out_recall.cpp \ invoice_dialogue.cpp \ component_search.cpp \ pcb_recall.cpp \ user_recall.cpp \ table_contents.cpp \ test.cpp \ partslist_and_locations.cpp \ monies_out_entry.cpp \ monies_in_entry.cpp \ balance_query.cpp \ invoices_in_due.cpp \ search_box.cpp \ timesheet.cpp \ payment_in_recall.cpp \ connection_dialgoue.cpp \ vat_return.cpp \ add_location.cpp \ recall_sundry_charges.cpp \ part_edit_dialogue.cpp \ mileage.cpp HEADERS += sqlforms.h \ ../shared_classes/rw_sql_utilities.h \ form.h \ login_dialogue.h \ partslist.h \ component_locations.h \ invoices_in.h \ calender_dialogue.h \ enter_invoice_in.h \ add_supplier.h \ retrieve_supplier.h \ table_dialogue.h \ invoices_in_filtering.h \ invoice_in_dialogue.h \ payments_out.h \ rwDateEdit.h \ payments_out_recalled.h \ payments_out_dialogue.h \ pcb_entry.h \ import_csv.h \ order_code_entry.h \ component_entry.h \ warning_dialogue.h \ purchase_order.h \ user.h \ purchase_order_recall.h \ import_bom.h \ csv_import.h \ component_usage.h \ invoice_out.h \ invoice_out_recall.h \ invoice_dialogue.h \ component_search.h \ pcb_recall.h \ user_recall.h \ table_contents.h \ test.h \ partslist_and_locations.h \ monies_out_entry.h \ monies_in_entry.h \ balance_query.h \ invoices_in_due.h \ search_box.h \ timesheet.h \ payment_in_recall.h \ connection_dialgoue.h \ vat_return.h \ add_location.h \ defines.h \ recall_sundry_charges.h \ part_edit_dialogue.h \ mileage.h FORMS += sqlforms.ui \ form.ui \ login_dialogue.ui \ partslist.ui \ component_locations.ui \ invoices_in.ui \ calender_dialogue.ui \ enter_invoice_in.ui \ add_supplier.ui \ retrieve_supplier.ui \ table_dialogue.ui \ invoices_in_filtering.ui \ invoice_in_dialogue.ui \ payments_out.ui \ payments_out_recalled.ui \ payments_out_dialogue.ui \ pcb_entry.ui \ import_csv.ui \ order_code_entry.ui \ component_entry.ui \ warning_dialogue.ui \ purchase_order.ui \ user.ui \ purchase_order_recall.ui \ import_bom.ui \ csv_import.ui \ component_usage.ui \ invoice_out.ui \ invoice_out_recall.ui \ invoice_dialogue.ui \ component_search.ui \ pcb_recall.ui \ user_recall.ui \ table_contents.ui \ test.ui \ test.ui \ partslist_and_locations.ui \ monies_out_entry.ui \ monies_in_entry.ui \ balance_query.ui \ invoices_in_due.ui \ search_box.ui \ timesheet.ui \ payment_in_recall.ui \ connection_dialgoue.ui \ vat_return.ui \ add_location.ui \ recall_sundry_charges.ui \ part_edit_dialogue.ui \ mileage.ui -
Hi,
If it's only one file, I would check whether it's present in the includes of the Qt version you use in case it has accidentally erased.
-
Strange issue...
One thing you can try is to create a new project and gradually add your files to it until the build breaks again.
-
@DiBosco said in QLineEdit: No such file or directory. However, other projects find it just fine.:
When I deleted all the .o files, I had the issue. Restored them, all and it compiled and ran fine.
When the .o file is already there the build system has no need to process the
rwLineEditcode. That's why you don't run into the error then.However, something is definitely broken in the project's build tree.
Look inside your Makefile; it might provide a clue.
Using Mageia Linux 7 and Qt Creator 4.9.0 based on Qt 5.12.6 (GCC 8.3.1 20190412, 64 bit).
That tells us the version of the Qt Creator IDE.
What is your version of the Qt libraries?