Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Creator keeping old files after deleting a project



  • I was trying to build something as a test mockup in Qt Creator, and I wasn't liking what was going on so I decided to start over with a new Project file, I closed Qt Creator, and deleted the Project Folders as well as the ones labelled [Debug] etc... so I go to start up Qt Creator and name it same thing as what I deleted before, and I go to the UI builder stuff and add in the stuff I wanted, naming them, connecting the elements up and stuff, and then I go to hit Run and I'm given a bunch of unrelated errors for the project in the Makefile about

    moc_projectname.o
    moc_projectname.cpp
    moc_projectname.h
    

    undefined references when it goes to compile after hitting Run, in the Makefile which shouldn't even be there. Qt Creator somehow was keeping a cached copy of the old deleted project files and added it back into my new project even though it should of all been deleted. I went to the exact directory where that Makefile was right from Qt Creator by right-clicking on Makefile and selected Open Directory Location, I deleted this when I was deleting the entire project before to start over from scratch, so this shouldn't even exist.

    I tested this again to see if it happened with a new project, but with an entirely different name, and I didn't get any undefined references in my Makefile this time after adding some stuff and hitting Run. How can I make sure that Qt Creator doesn't restore old deleted project files so that they're completely purged from memory?


    Qt Creator 4.5.2
    Based on Qt 5.9.5 (GCC 7.3.0, 64 bit
    
    OS: Linux Mint 19 (Cinnamon) 64-bit
    

  • Qt Champions 2019

    @Alkaris said in Qt Creator keeping old files after deleting a project:

    so I go to start up Qt Creator and name it same thing

    What does this mean? Do you create new project and give it the same name as the one you deleted?


  • Moderators

    Have you deleted the shadow build directory? 99% that this is where our old Makefile is located.

    That's usually in a dir named like ../build-projectname-Desktop_Qt_5_11_3_GCC_64bit-Debug, locate one dfirectory up from your sources.



  • @jsulm it means exactly as I said it does, how is that so hard for you to understand what that even means? [Deleted] -> [Make New] -> [Same Name]

    @sierdzio That's what I already said in my post, I deleted all the folders even the ones labeled with [Debug] made for building into, it's already clear what I said in my post. Can't make it any more clearer than what I've already stated in my original post.


  • Qt Champions 2019

    @Alkaris First of all you should be a bit more kind when asking for help - don't you think so?
    It might be clear to you what you mean because you are doing what you are doing, but from your description it isn't clear to me.
    But I will not bother you anymore trying to help you...


  • Moderators

    @Alkaris said in Qt Creator keeping old files after deleting a project:

    @jsulm it means exactly as I said it does, how is that so hard for you to understand what that even means? [Deleted] -> [Make New] -> [Same Name]

    @sierdzio That's what I already said in my post, I deleted all the folders even the ones labeled with [Debug] made for building into, it's already clear what I said in my post. Can't make it any more clearer than what I've already stated in my original post.

    Yes, but you also said that Makefile shouldn't be there, in the same sentence where you say you did run compilation (which generates the Makefile). In order to help you, we need to check the facts and for some idea about what can be wrong.

    Right now I'd guess what you're seeing are real compiler error messages, coming from your new code - because Qt Creator does not store old Makefiles anywhere outside the [shadow] build dir. It could store some configs in session, but that get cleared when you restard QtC, which you did.



  • @sierdzio the Makefile was in the build dir yes, but for some reason that old file was being copied into my new project even though the entire thing was deleted deleted, source directory and build directory both wiped. I did a little more looking around and I found that Qt does create cache files in my ~/.cache/QtProject directory which is where it's storing project files from even after closing and reopening Qt Creator, this doesn't get cleaned out after deleting a project or restarting Qt Creator because files still remain.


  • Moderators

    That's weird, I don't see any cached build artifacts on my end.

    Anyway, if removing that cache solves your issue, then that's good.


  • Qt Champions 2017

    @sierdzio said in Qt Creator keeping old files after deleting a project:

    That's weird, I don't see any cached build artifacts on my end.

    Neither do I. Not in the source directory, nor in the shadow build directory I have.


  • Moderators

    @Alkaris said in Qt Creator keeping old files after deleting a project:

    it's already clear what I said in my post. Can't make it any more clearer than what I've already stated in my original post.

    You can definitely make it much clearer:

    • Provide the "unrelated" error messages, verbatim.
    • Provide the paths of the directories that you deleted.
    • Provide the path of the Makefile that "shouldn't even be there".

    You can obfuscate your project name if you want, but show the directory structure. Why? For one thing, the information in your post was inaccurate: We know that if moc produces a file called moc_X.cpp, it will not produce a file called moc_X.h.

    Also, you could have:

    • Told us how you installed Qt Creator
    • Provide a screenshot on how you "right-click[ed] on Makefile and selected Open Directory Location"

    These are useful because the official version of Qt Creator doesn't show you the project Makefile, and doesn't have a menu item called "Open Directory Location".

    Your original post contained ambiguities that you didn't realize. The only people who would have understood your post 100% are people who can read your mind.


Log in to reply