PDA

View Full Version : qmake -tp vc Breaks Visual Studio 2010 Solution



davethomaspilot
12th July 2012, 15:49
I'm still struggling to get a low maintenance development environment using Visual Studio 2010 with the integrated Qt support.

Mostly, I love it! It's really convenient to redesign and refine dialogs using Qt designer and then just rebuild. However, whenever I have to add a new dialog, the overhead seems unreasonable.

I mentioned in a previous post that the qmake -tp vc causes the property sheet that defines required include directories, libs, etc to be removed from the VS2010 solution. Annoying, but not such a big deal since I just add it back after doing the qmake.

What's been much more of a hassle is getting things like "Go to declaration", "Go to definition", and "Find all References" working again after the qmake. I've done hours of surfing trying to figure out what's causing the issue and how to fix it.

I've tried many things, nothing seems to restore these nearly essential features after doing the qmake. Just this morning I confirmed it is the qmake that messes things up, so I think that means it has nothing to do with the source files, but rather something in the VS2010 environment.

What DOES work is starting a brand new VS2010 project, copying all the source files into a new directory, then running the qmake -tp vc there. Everything works fine until I add new source files with QObject and do qmake -tp vc again.

Any suggestions on how to debug this would be appreciated. Or, how do others work in Vs2010 with integrated Qt? I use the property sheet for configuring stuff like include and library paths, so I don't have to go through all the different places in the VS2010 GUI every time I start a new or derivative solution.

Thanks,

Dave Thomas

wysota
12th July 2012, 16:02
qmake -tp vc creates a new visual studio solution based on qmake project. If you already have a visual studio solution then there is no point in calling qmake -tp vc again. Just add appropriate files directly to your solution and they should be handled just fine.

davethomaspilot
12th July 2012, 16:11
Hmm, I thought I tried that and had issues with unresolved externals. I thought anytime I added a file with a QObject, I needed to redo the qmake -tp vc.

Thanks,

Dave Thomas

Added after 6 minutes:

Here's the thread where I asked if I really had to to the qmake -tp vc

http://www.qtcentre.org/threads/49406-Visual-Studio-10-with-Qt-Addin-Can-I-avoid-running-qmake-tp-vc?highlight=

I think I don't get the

davethomaspilot
14th July 2012, 22:01
Ok, I just add a new .ui file, and asslociated .h an .cpp file. So, I thought I'd try just adding these files to the Solution using the VS2010 interfaces as suggested by Wysota.

After adding these files, I do a build, but a a ui_ header file does not get created.

So, there must be another step to do? At this point, I'd normally do a qmake -tp vc and rebuild. That will work, but it will break the VS2010 features as I described earlier in this thread. The only way I've figured out how to fix the broken functionality, is to create a new directory, copy files from the existing VS2010 directory into the new directory, then do the qmake -tp vc newdir.pro. Everthing then works correctly.

I know others are not doing this everytime they add a new .ui file, so I MUST be missing something!

Thanks,

Dave Thomas

Added after 6 minutes:

Found this:

http://truth2.wordpress.com/2010/09/04/custom-build-rules-for-qt-under-visual-studio-2010/

Will try it out and post if it works.

Dave Thomas

wysota
15th July 2012, 01:37
ui_xxx.h files should get built if you use them. Sole adding a .ui file to the project will not build the file. qmake -tp vc should add a rule to your solution on how to build ui_xxx.h files. If you add more ui files to your project, that rule should still catch that new file. At least that was the case some time ago when I last used the VS integration thingy (however that was a couple of years ago).