Qt Creator UI header file location

  • I am building my Qt app with Qt Creator 2.0.1, on Windows 7 (from the SDK), using the mingw32 tools. My source code and .pro file all reside in foo\GUI, and I am doing a Shadow build in foo\build. It is annoying that when I make changes to a form the revised UI header is created in the build directory, and is not found by the compiler, which is looking for it in the source directory. I can copy the header file across manually, of course, but I'm sure there must be a way to have the file created in the same directory as all the other source files. Can someone throw some light on this?

  • Moderators

    Take a look at how you include the ui_<filename>.h files in your headers. It's probably looking for them in current dir. Add foo/build to qmake's includepath, maybe? Never had that problem myself, to be honest.

  • You can change where to create them using the UI_DIR variable in your .pro file. I prefer to not have them mixed with my source files, but that may just be me. I like to keep generated files and manually created files separate in your projects.

  • Thanks Andre, I'll try that. Any idea why in this case the compiler thinks the automatically-generated header is in foo\GUI, rather than in foo\build, which is where it usually looks?

Log in to reply

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