Important: Please read the Qt Code of Conduct -

How to setup Qt for MSVC2010 after successfull build (correct path moc.exe) (Change Qt-Path)

  • Hi!

    I build Qt with MSVC2010 on another machine in the directory C:\Qt\473. I copied the files and directories to my home computer to D:\Qt\473. The path to moc.exe i incorrect now if try to build an example. Visual Studio can't find moc.exe. Is there a way to correct with rebuilding Qt?

    Thank you!

  • And one more thing, in your title its not QT ( QuickTime), its Qt.

  • Hey! Thanks for replying.

    My description is a bit buggy. The problem ist that MSBuild shows the error. It can't find moc.exe. I think qPatch is not the thing i need here (does not patch binaries, right?)...i will try qt.conf.
    Where to put the qt.conf? In the main Qt-Directory?

  • That is a really good question. I could not find it in the text.

  • "Here": are directories given, but not for windows.
    I would check with the Qt dir. Possibly there is the ...\mkspecs\win32-msvc2010 as another possibility, but I do not know how those are used for compilation.
    BTW: Did you install "vsaddin": on the other computer?

  • Hi! I cleaned it by uninstalling/reinstall the Qt-Addin for VS. If i create a new project it works. The examples delivered with Qt cannot be build. But that's a Visual Studio-Thing. If i open the .vcxproj file cretaed by nmake there's the wrong path. It's the custom build tool.

    So i tried to change it in Visual Studio's project properties...but i can't find it.

    Maybe this is what qPatch is for... search for old directory and replace it with your new one.

  • I have no experience in that direction. Just remembered that there was a post providing the information for a patch. I did in the past do always a new compilation.

    It could be that you have to put the qt.conf to the directory where vsaddin resides.

  • Tried luck! I searched with AgentRansack in the Qt-Directory for the's in almost every file...

    I hope this thread can be solved...or i'm the first one with this kind or problem?

  • Did you have a look to the source of qpatch ?
    Respectively, did you try to use?

    As it looks it simply does read all the files in question, supplied in a file list. Every occurance of the old dir path will be replaced with the new dir. This seems to be fairly simple. However, I will not recommend doing without that tool. But it might be worth a try.

  • I tried it. At first i will modify the src. So that it pathes all files. It makes no sense to pass every file in the qt-dir to the command-line. I'll modify it so that it patches each file. Or could you tell me with files i have to patch? This is a real trivial thing and Qt makes to much work out of it...

  • If you go to the "repository": there is the short cpp-file and also the lists of files to change.

  • Yes. Thank you!

    But one problem resists: The path to Qt in the files is different from file to file.

    Example1: C:/Qt/
    Example2: c:\Qt
    Example3: C:/qt

    It's necessary to run qPatch more than one time to patch all files.

  • Glad to see that you were succeeding.

    What is the OS you have?

    I was trying it myself after the last post. However, the it was not as easy to handle as it looked in the beginning. I have Win7 64 bit. All security measures were activated. I could not debug nor run it easily from a command prompt. I am wondering about the best way around such issues. It is not helpful when you cannot read the output messages on screen.

  • " I could not debug nor run it easily from a command prompt " ... you can't run qPatch?

    I think we should correct qPatch to make it a bit more comfortable. Why can we install Qt with mingw without these problems or Qtmsvc2008 without these problems...and after building with msvc2010....problems.

  • I can run, but it is not as you are used to. However, this is not a Qt problem.

    In case you are not aware of this. On Win7 ( and Vista) you have to confirm the actions of any program trying to search the disk or writing to the areas where programs are installed. When you start such a program a window pops up asking for confirmation. Unfortunately, the functionality is not returned to the command window you started off, but it is continued in a new command window. The window pops up and it is closed when the program finished. Unfortunately the output is gone with closing of the window. :-( Simple piping did not work, so I had to change qpatch to write to disk. So this becomes quite ackward when you are trying to find the proper spelling of the dir names as you lined out above.

    The debugging is probably not running because of Win7 again. The same security measure signals a nogo to the debugger.
    BTW it could be also an additional feature of the virus scanner.

    Probably one can switch off all these security features, but on the other side I prefer to see, when someone else is going to do things on my machine.

    I guess most of the problems are existing because more open source ethusiasts are on linux. Would be interesting to see a statistic about that.

  • The link you referred to was broken. Can you find it again and post the new location? I'm trying to find the list of files that needs to be patched. Thanks

    [quote author="koahnig" date="1309794847"]If you go to the "repository": there is the short cpp-file and also the lists of files to change. [/quote]

  • [quote author="textral" date="1324554733"]The link you referred to was broken. Can you find it again and post the new location? I'm trying to find the list of files that needs to be patched. Thanks

    here is a link again.
    However this is not a solid way to reference it. It seems to be part of a clone, which google spilled out. The link may be broken again soon. Furthermore, the status is completely unclear. Unfortunately, I could not find that section in the official source tree of creator anymore.

  • Here is a "link": to the source found on my drive. The source has been adapted for debug output to a file. I doubt that there are other changes. However, one has to check anyhow.

  • Fantastic koahnig, thanks.

  • You are welcome

    You have the little problems still existing with the different path definitions possible under windows. So, if you have a solution, I appreciate when you share this.

    Season's greetings

Log in to reply