1

Recently I am working on a Visual Studio C++ project that can copy files using win32 API. Now I try to add a Qt GUI to it. But all tutorials I found suggest that I should setup a new QT project or convert the VS project to CMake project.

I also spot a similiar question. According to the answer, I unload the project and add <Keyword>QtVS_v304</Keyword> (I got this from a newly created VS QT project). I got these errors as I tried to build the project:

error : There's no Qt version assigned to project FNP.vcxproj for configuration Debug/x64.
error : Please set a Qt installation in 'Project|Properties|Configuration Properties|Qt Project Settings|Qt Installation'.

I don't quite understand why modifying .vcxproj would work or how to make it work.

Is there a better way to add QT support to the existing VS C++ project?

Any suggestion would be appreciated!

p.s. To assist, Visual Studio Community 2022, QT 6.2.2, QT VS Tools ver 2.8.1(rev.6)

  • Simplest approach is to create a new QT application and getting it building / running. Then copy your exiting code into the project and fix it up. There are too many project settings, framework settings etc to change. – Richard Critten May 16 '22 at 11:06
  • Noooo. It's a practical way, but not that elegant. – play_as_megumin May 17 '22 at 04:48

1 Answers1

0

It is just telling you that the Qt setting for your project for that configuration ("Debug") and platform ("x64") do not match.

In Visual Studio, in the Solution Explorer, right-click your project and select "Properties", then "Qt Project Settings" or alternately right-click your project and select "Qt" then "Qt Project Settings". You will be presented with a dialog. Find the attribute "Qt Installation" - there should be a drop-down for it. Select that drop-down and select the correct Qt version.

For any given project, you should set that value for any configuration/platform combination you wish to build.

It gets a little trickier for teams with multiple members and automated build tools - users may install Qt to different directories and name the version differently. That means a project that works form my particular environment may not work for the automated build nor another team member, and vice verse. The way around that is to build tools to run on the solution and project set just after checkout.

GTAE86
  • 1,780
  • 3
  • 29
  • 39