Building/viewing Qt 5.1.1 source from within Visual Studio



  • Hey people,

    I'm in a fickle little situation where I may have the answer, but maybe not. I'm interested in building the Qt source from within MSVC (2012). To be accurate, I'm interested in getting to know Qt for the purposes of development, and viewing the source code in my preferred IDE would be very helpful (perhaps even crucial). Essentially making use of MSVCs intellisense thingy to find references, figuring out objects etc.

    I've seen a bunch of questions about turning .pro files into .sln but all my attempts so far have yielded nothing but errors. When I read about compiling Qt using MSVC, I keep expecting that the end result is simply a bunch of .lib files that can then be integrated into a different project for use with MSVC - this isn't what I'm after.

    So far I've basically fetched one of the prepared sources from here (for MSVC 2012):

    http://qt-project.org/downloads

    and run configure, with... well.. I'm not sure which flags to pass it to achieve what I want... The next step I've read is to run nmake, which is supposed to compile everything - but this is where I wonder - will this also generate SLN files that will allow me peruse the Qt source? So far I know it apparently meddles with the MSVC IDE by adding a Qt menu or something? Not something I'm too keen on, unless its a future requirement for compiling Qt from within SLN.

    So once again - for the sake of clarification - I'm interested in building/viewing at the Qt source from within MSVC, not building it for the purposes of using it in a new app.

    Am I on the right track here with the source? Is nmake the next step for me?

    Many thanks,
    Gazoo


  • Moderators

    Hi,

    If you want the ability to view source code within the IDE and have IntelliSense integration, compiling Qt from scratch will not give you what you want. Instead, you need the Visual Studio Add-in 1.2.2 (at the bottom of the link you posted), but you also need a non-Express version of Visual Studio to use it. Visual Studio Express does not accept add-ins, unfortunately.



  • Hey JKSH,

    Thanks for taking the time to post. I use a retail version of Visual Studio - so no worries there...

    I am still trying to wrap my head around things. Could you elaborate why the Add-In is needed and what it does?

    Also - I am still in the dark as whether or not the 'nmake' command will create/generate the .sln files I crave...?

    Regards,
    Gazoo


  • Moderators

    Hi Gazoo,

    See "here":http://blog.qt.digia.com/blog/2012/12/19/visual-studio-add-in-1-2-0-for-qt-5-released/ and "here":http://qt-project.org/faq/answer/what_is_the_qt_visual_studio_add-in for an idea of what the VS Add-In is for.

    [quote author="Gazoo" date="1384156191"]I am still in the dark as whether or not the 'nmake' command will create/generate the .sln files I crave...?[/quote]No.

    nmake is a tool for processing Makefiles. A Makefile is a recipe that tells your compiler how to build your project, just like a .vcproj file. nmake and Makefiles are completely unrelated to .sln files.



  • Hey JKSH,

    Thanks again - the fact that the add-in allows for the importing of .pro files makes a number of things clearer.

    I would seem to me that it's still possible to somehow use qmake alone to achieve what I wanted, but having installed the add-in and directed it to my Qt version - which apparently needed to be the 'qtbase' folder in my source, I can now open the .pro files.

    Although I still seem to get a ton of:

    failed to refresh moc step

    errors. Not that it stops visual studio from reading the .pro file.

    Regards,
    Gazoo


  • Moderators

    You're welcome :)

    [quote]Although I still seem to get a ton of:
    failed to refresh moc step[/quote]I don't use the VS Add-In myself, so I don't know what that is. You can start a new thread to see if anyone can help you with that.


Log in to reply
 

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