PDA

View Full Version : Qt Open source + MSVC++ 2008



TopFuel
4th October 2007, 21:06
I'm completely new to QT programming and have installed QT Open Source 4.3.2 and Microsoft Visual C++ 2008 Express Edition beta. According to a trolltech blog: .......Today (a week back actually), we made another big move. We have decided to support Visual Studio Express with Qt/Windows Open Source - we are dual licensing the MSVC Makefile and project generator........

What are really the steps I have to make before I can compile my first QT application?
Do I have to download and install the Windows platform SDK?
Should I run "Qt 4.3.2 (Build Debug Libraries"?
Seems like I have to manually add some pathes to the "VC++ Directories" in VC options anyway.
Why don't Qt add the necessary info to the PATH variable during installation?
Why don't Qt add the QTDIR variable during installation?
How do I use this project generator thing?

marcel
4th October 2007, 21:11
Why don't Qt add the necessary info to the PATH variable during installation?
Why don't Qt add the QTDIR variable during installation?

That is really is to do. Practically it shouldn't take you more that 30 seconds to do it.

The reason why they don't add it because there is no installer for the open source version (only for the mingw compiled version).



Should I run "Qt 4.3.2 (Build Debug Libraries"?

Only if you need the debug libs. But, since you are just starting, it is a good idea to have them, because you might get curious about what happens under the hood.



How do I use this project generator thing?

qmake?
you can generate a vcproj from a pro file.



Do I have to download and install the Windows platform SDK?

no.

TopFuel
4th October 2007, 22:43
I took the source files from one of the included samples and tried this:
1) I ran "qmake -project tabdialog" to generate a .pro file. It worked.
2) According to the documentation, Qt should be able to generate a Visual Studio project from a .pro file, but they don't explain well how to do it. "qmake -t vcapp" just says "WARNING: Unable to generate output..............". How should I do it then?

marcel
4th October 2007, 22:47
qmake -tp vc -o hello.dsp hello.pro

TopFuel
5th October 2007, 19:59
Thanks for the help. Now I know how to to get a *.dsp file from a *.pro file. The bad thing is however that both Visual Studio 2005 and 2008 is unable to open it. It says "The project file .............dsp has been corrupted and cannot be opened.". Am I still doing something wrong or?

marcel
5th October 2007, 20:18
qmake is able to generate vcproj file too.
Just call:


qmake -tp vc

but first make sure you already have the pro file generated.

TopFuel
6th October 2007, 19:17
I'm getting closer, but I'm still not there yet!

I used the QT command prompt for running your suggested commands. That is why it didn't work because the QMAKESPEC system variable that I manually added is not used in that command prompt. After using the ordinary command prompt, things started working and I got a *.vcproj file that Visual Studio could open.
When I compile my project in Visual Studio I get an error like ".........cannot open input file 'c:\Program\Qt\4.3.2\lib\qtmaind.lib'". There are no such file on my system. How do I get it?
I think it has something to do with "nmake", but I have not been able to run it with any success yet.
Thanks in advance for the help!

marcel
6th October 2007, 19:37
Compile your app in release mode. Qt open source does not come with the debug libraries compiled. You have to build them yourself. There's even a shortcut in the start menu for that.

Anyway, I suggest to drop VC 2008 and use Eclipse CDT + Qt Eclipse Integration + mingw. The only drawback is that gcc is a bit slower than mscc but that won't kill you.
On the bright side, you will work with a professional IDE and release yourself from MS crap.

TopFuel
6th October 2007, 19:57
Compiling the app in release mode in VS2008 results in an error "cannot open input file "c:\Program\Qt\4.3.2\lib\qtmain.lib". There are no such file in my system either.

When I run the "Qt 4.3.2 (Build Debug Libraries)" from the Windows start menu, it says that QMAKESPEC is win32-g++ and I don't get any chance to change it either, so no *.lib files are created by running that.

I downloaded and installed the qt-win-opensource-4.3.2-mingw.exe file. Was that a mistake?
Should I have downloaded the sources instead?

marcel
6th October 2007, 20:09
I downloaded and installed the qt-win-opensource-4.3.2-mingw.exe file. Was that a mistake?
Should I have downloaded the sources instead?
Yes it was. That version is for mingw only. you cannot use it with msvc.
If you really need to, then download the sources and build them. that will take some time but it will work.
When you configure the build make sure you select debug and release.

After the build and install are complete you will have to set the following env vars:
-QTDIR=your qt dir
-PATH=%PATH%;%QTDIR%\bin;
-QMAKESPEC=win32-msvc or whatever is called(maybe you'll even have to tweak it a bit, since there's no support for 2008 yet).

BTW: I am very happy to see your interest in Eclipse & open source tools.