Old and New projects keep mixing.



  • Hi. I Tried finding an answer on the web, but I'm not exactly sure what I even need to search for.
    Any help will be appreciated...

    MY SETUP:
    I Have a directory where I run my project from.
    This directory contains incremental folders 1,2,3,4... These are the versions/builds as I progress on the project.
    Each time I get to a point where the program compiles with a new improvement I create a new folder and copy the files to the new directory.
    This includes the following:
    build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug
    AND
    Contact_Noise

    MY PROBLEM:
    When opening an old version lets say from folder 1, and compile it.
    The MainWindow that appears is that of folder 23 (The latest version).

    WHAT I HAVE TRIED SO FAR:
    I Deleted all files in folder 1 except the source, header and .pro files.
    When opening the project from folder 1 again it configures the project.
    And then runs the correct MainWindow from it's own folder.
    But now the opposite happens again.
    When running the latest version from folder 23 after doing the above, the MainWindow is that of the old project in folder 1, and not from its own folder 23.


  • Moderators

    Hi,

    This happens because the a GUI file (something like "ui_mainwindow.h") gets generated in build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug. One solution is to clean your build before you recompile (In Qt Creator: Click "Build" -> "Clean Project" ... or just delete build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug )

    But anyway, may I suggest a better way of backing up? Instead of copying your project folder, use a proper version control system. "Git":http://www.sourcetreeapp.com/ is quite popular. Using Git to backup your project will avoid the problem you described, and it also lets you see the exact changes you've made across different versions.



  • Thanks. I will look into Git. Looks quite nice.
    Cleaning the project does seem to work.
    Although I'm a bit puzzled.
    If the GUI file gets generated in build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug.
    And the build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug folder is unique to each incremented folder.
    How do the two get mixed up.

    Example: If I open the project version 1. Then it should use the data stored in the build-Contact_Noise-Desktop_Qt_5_3_MinGW_32bit-Debug folder 1 and not that of folder 23. Why does this happen or am I misunderstanding something here?


  • Moderators

    Actually, I just remembered: The absolute path of your build folder is hard-coded into your configuration file. Open your *.pro.user file with a text editor and look inside.

    Even after you move/rename your project files, your configuration file will still point to the old location. Thus, the build system will still build into the old location, unless you reconfigure your project. You can erase the configuration by deleting the *.pro.user file.

    However, using Git for backups is still the recommended solution.



  • Ok. Does make sense.
    But I cant spot the build path in the pro.user file.
    The file is to big to post here. Is there a particular variable or tag I should be looking for.
    Or did you not maybe mean that it should be in the .pro file???

    According to the build settings in QtCreator it should build to the following path:

    ../build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}

    This means it should build in the source folder each time.


  • Moderators

    [quote author="achmed" date="1415190606"]I cant spot the build path in the pro.user file.
    The file is to big to post here. Is there a particular variable or tag I should be looking for.
    Or did you not maybe mean that it should be in the .pro file???[/quote]I meant the .pro.user file.

    Search for the string "ProjectExplorer.BuildConfiguration.BuildDirectory"



  • Bingo. Thank you very much. You where of great help. Now things make much more sense. I Will look into Git and try to implement it ASAP. :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.