PDA

View Full Version : Convert VS2010 project from Win32 to Qt5



bmahf
2nd September 2015, 19:29
I am working with a Win32 project in VS2010, and am trying to move it from being a console project to being a Qt windowing project. I have Qt Add-in 1.2.2 with Qt5.1.1.

I looked online for how to do this, and found a number of links that seemed helpful. Particularly this one (others seem to say the same thing):

http://stackoverflow.com/questions/2088315/how-to-convert-a-regular-win32-vc-vcproj-project-to-a-qt-project

But when I completed the steps that Benjamin gave in his answer, and rebuilt, I got the error message:

error LNK1181: cannot open input file '\.obj'

Not a very helpful link error. I am not sure if Qt4VSv1.0 is correct, and have looked all over for information as to how this keyword is to be constructed. I assume that it should start with Qt5, but I'm not sure what the v1.0 refers to. Is that the add-in version?

I tried changing that to Qt5VSv1.2, but when I reloaded the project and right-clicked, the "Convert project to Qt Add-in project" option wasn't there, but a "Convert project to QMake generated project" was, and it was not highlighted so I couldn't select it. Changed it to Qt5VSv1.0 and got the same thing. Should I really be using the Qt4VSv1.0 keyword for Qt5.1.1 with add-in 1.2.2 on VS2010? I have no idea how to find out what this should be. And I don't really know what exactly this error is trying to tell me.

Also, Benjamin's instructions said that I should "add" the <keyword>Qt4VSv1.0</keyword> entry into the <PropertyGroup Label="Globals"> tag, so I had both the <keyword>Win32Proj</keyword> and the <keyword>Qt4VSv1.0</keyword> entries in there. I tried starting from scratch and taking out the Win32Proj entry, but that didn't make a difference.

Henrich
3rd September 2015, 12:06
Hi!
First, it's important that if you are building for 32bit, you also have also 32bit version Qt and also it should have the same compilator MSVC not mingw.

The keyword should be <keyword>Qt4VSv1.0</keyword> that is correct, I am using VS2012 and Qt5.2.1 and it is working.

Maybe you could try newer version of Qt_vs_addin, try version 1.2.3, for example 1.2.4 is not working with VS2012, don't know why, and I am not the only one with this problem.

bmahf
3rd September 2015, 17:59
Thanks for your reply. Yes, I think it must be something with Qt Add-in 1.2.2. I was going a little bit crazy yesterday, since (as always happens when you run into something like this) I'm under a pretty tight deadline. I finally made a copy of my whole solution folder, and then reverted the original back to a buildable copy from SVN (thanks SVN!!), and then I diffed the .vcxproj in the reverted folder to the one that wasn't working. I tried manually changing stuff in the one that wasn't working and compiling, and what I found was that the 1.2.2 add-in had put a $(INHERIT) variable into some places. In one of those places it had the form: <some_previous>\;$(INHERIT)\;<some_next> ... So somehow it messed up. I removed the backslashes and it just compiled like ever before. So though I don't have time to be sure right now, I'm thinking you are probably correct about the add-in version. Thanks again.