Technology Sharing

Qt WARNING: Failure to find: xxxxxx.h

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

After re-planning the custom folder, compilation errors occurred, such as

Qmake WARNING: Failure to find: xxxxxx.h

or

error: XXXX.h: No such file or directory

If the file is directly relocated to a new directory under Windows, you need to modify the .pro file

The old files may not be commented or deleted, as follows (commented)

  1. SOURCES +=
  2. # BoyAndGirlExample.cpp
  3. # CharExample.cpp
  4. # FontExample.cpp
  5. # TextEditorExample.cpp
  6. # buttonexample.cpp
  7. # comboxexample.cpp
  8. # datetimeexample.cpp
  9. # defaulthandlerexample.cpp

After the directory is reorganized, references between files need to be made based on the relative paths of the files, such as

  1. #include "widgets/FontExample.h"
  2. #include "widgets/numconvert.h"
  3. #include "widgets/spinboxexample.h"
  4. #include "widgets/buttonexample.h"
  5. #include "widgets/sliderprocess.h"
  6. #include "widgets/datetimeexample.h"
  7. #include "widgets/timerexample.h"