Moc and ui*.h files always get deleted when I switching platform



  • I probably messed up my QT installation on my host.
    Whenever I start a QT application, after switching to x64 platform
    and choosing QT version, the ui and moc's files always go missing.
    Hoping someone here can help me fix this issue.
    I think I should have started every project on a VM, this time I didn't,
    so regretting.
    Windows 7 x64
    Visual Studio 2010 Ultimate SP1
    Thanks
    Jack



  • The files with .moc extension are generated files.
    The .ui files should be part of you sources tree.

    Does it happen in Visual Studio Qt Add-On or QtCreator?



  • @andreyc: I think he means the generated ui*.h files, not the .ui files itself and those are generated files as well and only temporary so you should never modify those files anyway. I don't think the files get deleted if I change the build kit, but still that should be no problem really.
    What are you trying to do? :)



  • Hi,
    It happens in Visual Studio Qt Add-On.
    I forgot I have changed the environment variable "path" or something
    But when I point it back to the directory
    say
    X:\QT5\qtbase\bin
    the problem starts to appear.
    This both happens when I open an old project and create a new one.
    Thanks
    Jack



  • As Xander84 pointed, most likely you are looking at the generated files.
    The "moc":http://qt-project.org/doc/qt-5/moc.html#moc and "uic":http://qt-project.org/doc/qt-5/uic.html generate the moc_*.cpp, *.moc, and ui_*h files during build.

    So, when you create new project the files do not exists until you run first build.
    In old project they will disappear when you run "make clear"

    Why do you need these generated files?



  • You can conditionally set MOC_DIR, RCC_DIR, UI_HEADERS_DIR and UI_SOURCES_DIR variables in your .pro file depending on your platform. That way, the files are generated in separate locations.
    You should consider doing this for OBJECTS_DIR and DESTDIR as well, if you are serious about switching platforms.


Log in to reply
 

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