Qt6.4 cannot find the header file after opening the existing project

1. Problem recurrence

The classmate sent me the written QT project  through QQ , and I didn't think much about it, and directly built the QT project in the current download directory. (Because I thought the original construction directory name was too long, so I modified the default construction directory name, so the project name generated from the shop source file is called shop-Debug) After opening it, people are stupid ⊙▃⊙, why there are
insert image description here
various The problem that the header file cannot be found?
insert image description here
After some exploration, I finally found the problem.

Two, solve the problem

 Let's start with the conclusion: the paths of all levels of the Qt project cannot contain 中文or 空格, otherwise various header files will not be found and compilation problems will occur.

 It can be seen that the two Chinese characters "Tencent" appeared in the path we initially built the project, so the above-mentioned problems naturally appeared. The solution is also very clear, just put the source file in a path that does not contain Chinese and regenerate the project . But it should be noted that directly dragging the source file into the appropriate path will not work, because the executable program is still in the original path, such as the following example:
insert image description hereinsert image description here

 The correct way is to delete .pro.userthe file , which is used to record the path to open the project, the compiler used, the tool chain built, the generated directory, the version of qt-creator that opened the project, etc. After removing it, opening .prothe file and reconfiguring the project successfully resolved the issue.

insert image description here

Guess you like

Origin blog.csdn.net/whc18858/article/details/127476225
Recommended