Qt Creator not picking up changes to .cpp files, will not build unless I first clean the project?
-
Using Qt Creator 19.0.0 on Linux Ubuntu 24.04 (gcc_64) from revision 99d590c8c9:
I was used to making little changes in a source file and then right-clicking the single file in the "Project" view, then choose "Build" from the context menu which should register that the file had changed and then re-compile the selected source file.
Now, when I do the same, and after I save the file, I get this in the "Compile" output (for example, I want to compile "MySource.cpp"):
make: Nothing to be done for '.obj/MySource.o'It isn't picking up the changes I just made.
I consider this to be a bug ... does anyone have a workaround, or knows about a setting in "Preferences" which I can set to revert to the old behavior?
(EDIT: In my qmake project file, I have set a custom
OBJECTS_DIRwhich is why there is a subfolder.obj/in the compiler output) -
The plot thickens...
I cleaned out the entire build directory, including what I thought might have been a stale
.qmake.stashfile. After building everything successfully from scratch, I introduced an error by intentionally misspelling one of the variables in a function inMySource.cpp. Tried to compile that single file and got the same error as reported above.So I corrected the error, right-clicked once more on the file name in the "Projects" view, and now I have this error:
:-1: error: No rule to make target '.obj/MySource.o'. Stop.Once again, I click on the main "Build" icon on the bottom left, and everything successfully compiles and links. I tried to make a minimal project to reproduce the error, but I cannot pin it down. It doesn't seem to have anything to do with the presence of the
OBJECTS_DIRvariable. It could be that the source file is in a subproject of the main project which hasTEMPLATE=subdirs. But the subproject isTEMPLATE=app. And this did work for many years (i.e. compiling a single file from the "Projects" view context menu). Something has broken recently.