Sign in to follow this  
XTAL256

Using Qt with Visual Studio 2008 Express Edition

Recommended Posts

XTAL256    106
I have just installed and setup Qt (and upgraded to VS 2008) and i would like to know what the best way is to use Qt with Visual Studio. I am using the Express Edition which does not support plug-ins, so i cannot use Qt's VS integration. The process to build Qt applications using VC++ is to run qmake, Qt's pre-processor, which generates source code for UI files and processes Qt-specific C++ additions. It outputs a makefile which you then pass to nmake to compile. I found that i can specify custom pre-build steps in VS, so i can run qmake there, but i wonder if i can get VS to pickup that makefile that is generated and use that to compile. If that is not possible then i guess i will just have to manually copy all the configuration settings from the makefile to the VS project's settings. It would be good if there was a tutorial or something which shows how to setup a VS project with Qt (without using Qt integration).

Share this post


Link to post
Share on other sites
aryx    402
Does this blog post help? In particular, you're gonna want to go down around step 7. I can also point out that you can also use qmake to generate Visual Studio project files from qmake project files, if you'd like to take that approach.

Another option would be to use Qt Creator. I myself use Qt Creator a fair bit and actually really like it as an editor. It still has its quirks and bugs, but it's a fairly new kid on the block. Plus, qmake, designer and other Qt related things integrate with it. Unless you have a reason not to use it, I would suggest giving it a try for your Qt-oriented projects.

Share this post


Link to post
Share on other sites
XTAL256    106
Thanks for the link, it mentions creating a Makefile Project in Visual Studio. I have read that i can do that, but i have already created a normal project. I wonder what the difference is with a makefile project, it should just be different settings or something shouldn't it? I will have a look at it when i get home.

As for Qt Creator, i have not really looked at it, but i would prefer to use Visual Studio as an editor and compiler. I already installed Qt for VS 2008 so it's setup to be used with it. But apart from that, i am just used to using Visual Studio and i don't want too much of a dependency upon Qt since i only intended on using it for the UI. I guess i am being picky, but where there's a will there's a way, so i might as well keep using VS if i can.

Share this post


Link to post
Share on other sites
XTAL256    106
I'm not sure the steps in that tutorial work with Qt 4.6. When i enter the commands as it says, i get the following errors:
"QFileInfo::absolutePath: Constructed with empty filename"
and
"NMAKE : fatal error U1073: don't know how to make 'release-all'"

The Qt tutorials say to build an app using the following commands:
qmake -config release
nmake


That works if i enter it in a command prompt, i'm just not sure how to do it in the VS makefile settings.

Share this post


Link to post
Share on other sites
XTAL256    106
Ok, i have it working now.

There is just one minor problem of VS always saying that the build is out of date when i run it, but it's no big deal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this