Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to build and run in Visual Studio?



  • I have a simple project hat I've been working on it QtCreator and wanted to see if I could compile in Visual Studio. It only has one .pro file and uses qmake to build.

    I opened Visual Studio (Qt tools were already installed) and selected Qt VS Tools/Open Qt Project File... I then browsed to my .pro file. Visual studio opened it and generated a few files. When it seemed done, I clicked on the run button labled Local Windows Debugger to compile and run my program. However, all I got was an error message saying "cmd.exe" exited with code 2.

    Did I forget a step?


  • Qt Champions 2017

    Are you working in Qt Creator with Qt Visual Studio libraries &MSVC compiler ? Did you install the visual studio plugin ?


  • Qt Champions 2019

    @kitfox As @dheerendra suggested you can use Visual C++ compiler in QtCreator without using Vsual Studio. Do you really need to use Visual Studio?



  • I used Visual Studio IDE because I thought that's what you were supposed to do. At this point I'm just testing it out to see how well it works. Was also interested in seeing if it might provide a better debugging experience.



  • @dheerendra I installed the Qt plugin for Visual studio. I don't know the answers to your other questions. I just went with the defaults.


Log in to reply