Important: Please read the Qt Code of Conduct -

How to change location of generated mocing files?

  • Hi,

    I tried to migrate QT4 project to the latest version (QT5) and I am coming cross a problem.

    The generated mocing files always include "stdx.h" that is not in the file folder of generated files. The solution is I have to copy "std" to the target file folder. Is there way to change mocing settting so that the mocing file is generated automatically incude the as followings

    #include "../../stdafx.h"

    Instead of

    #include "stdafx.h"

    I am using VS2013 and converted the project to QT add-in project.

    Anyone can give me a hint?


  • Moderators

    You can use -f option of MOC. I am not sure if that is doable using qmake.

    In any case, stdafx.h should be in your system environment, without any need to copy it anythere.

    You can also tell qmake to generate MOC files somewhere using MOC_DIR variable.

Log in to reply