Building Qt5 projects via VS2012 Visual C++ project

  • First of all, is it even possible? It seems like with VS-add-ins and what not, Qt wants to have its fingers throughout the build process.

    If I just wanted to identify Qt (i.e. includes, libs, etc) as part of a Visual C++ project, is that all we need to do: i.e. identify those directories and such?

    If we need to use the add-in, or even work through QtCreator, we will, but I'd like to run through Visual Studio since that is our preferred IDE.

    Thanks in advance...

  • Well for starters, you need a way to launch the "moc compiler": from a VS2012 project.

  • There is that. Which is all orchestrated via the Qt5 add-in?

  • Haven't tried the Qt5 add-in myself (after 20+ years with Visual Studio, for me it feels refreshing using QtCreator :-), but If it succeeds in building a Qt app then it has to run the moc at some point...

  • Okay, well I don't disagree. If there's an intermediate code-generation step, no problem. It seems that there's got to be a way to either: 1) run a pre-build step, or 2) that the Qt5 add-in allows working with QtCreator "PRO" and "PRI" files. Which I see it does; not having done this through Visual Studio before, is it that the add-in wants to work exclusively with PRO and/or PRI files as opposed to native VS2012 project files? It might make sense considering there is potential for generated files. Mainly I just want to know what I'm working with is all... Thank ye...

  • Or perhaps I am not seeing this correctly. It seems the add-in wants already-existing PRO files to work with. Which means that QtCreator is necessarily inescapable. Ugh. That's important to keep in mind as well for our Continuous Integration steps.

  • It's not that bad :-) Qt I think does a good job of trying to integrate with tools like Visual Studio. For example, once you have successfully built your app inside QtCreator, you can continue edit it with Visual Studio (or Notepad..) then to enter another build cycle:

    1. Start a Developer Command Prompt for VS2012
    2. CD to the build directory of your app (where there's a makefile)
    3. Type nmake

    and you should have a new .exe.

    EDIT: BTW, if you want to test/run the new .exe. you can invoke the qtenv2.bat (found in Qt's installation dir), to establish a path to Qt's DLLs in your Developer Command Prompt.

  • I'm sure it's not. The actual process does not intimidate me. Nor does the fact that Qt involves its own dialect of C++; so suddenly we're locked into the Qt motif, when maybe all we're interested in is basically fancier language standards.

Log in to reply