Qt Integration with Visual C++ 2010 Express Edition, how do I do this correctly?
-
Alright. So I can create a new project in Visual Studio called "Hello Qt", add the includes and libs, write some Qt code, go to the project directory via VS command line, and type nmake? (or jom once I get the hang of command line compiling, lol) But is this what I need to do? Will it result in an executable?
Or can I even just compile it in the IDE instead? Or how do I do more advanced things like managing debug and release builds, building DLLs, etc?
EDIT: Alright, I've been reading nmake documentation on MSDN and it makes sense, it just compiles everything accourding to a makefile. Configure.exe must've made that makefile.
So I'll just wait until nmake finishes...
-
First you have to build Qt Libs with Visual C++ 2010 compiler. To do this you need first to run something like this from VS C++ Command Promt in Qt source directory:
@configure -debug-and-release -opensource -platform win32-msvc2010@ There are a number of other arguments for configure, you can take a look "here":http://doc.qt.nokia.com/4.7-snapshot/configure-options.html.
Second, you need to run
@nmake@ or
@jom@ if the latter is installed.
After this steps you will finally have Qt libraries built (building will take 2-3 hours).Now you can compile your application with MS VC++ and link it agains Qt Libraries that were just built. You can use either Qt Creator for this or VS with "Qt VS Add-in":http://doc.qt.nokia.com/vs-add-in-1.1.7/index.html. Unfortunately, it’s impossible to install this Add-in on Express version of VS.
-
When you have started the configure this is only part of the story. After the configure concludes you should see the next step. If I remember correctly, there are two possibilities offer. One is just starting "nmake". This will finally create the Qt tools. The second possibility listed is "nmake confclean" or similar, if you want to start all over again.
After you have generated the Qt tools and libs you should be able to do the rest through IDE. However, I do not know how th handle from that point since I am not using VS express. I am using VC2005 with a license.
[quote author="Tobias Hunger" date="1308811614"]There is a visual studio plugin for Qt development available somewhere. I am not sure that one will work with visual studio express though (wasn't there something about that not supporting plugins?).
[/quote]This could be an obstacle for you. I cannot verify.
As already suggested by Tobias Hunger there is a possibility to use QtCreator as an IDE for your purposes. Also in Creator you can use the MS compiler.
-
Where will the libraries that I'll need to compile with be stored? (I'm still generating them with nmake) And would I be able to use cl.exe to compile my Qt projects without the add-in? Or can I just specify my include files and libs in the IDE, and build normally?
-
Yes, you can use cl.exe. To my understanding it is the same as in other vc versions.
The location of the Qt libs should not be the problem. Either you have used a prefix in the configuration step, but I think this is only available in linux, or they will be in the directory where you were building the Qt version.
So if you unzip into "C:\Qt" for example, there should be a directory lib now. There you have the libraries you need for linking and also the dlls. The includes are under include. All is straight forward. You need to use the include in the IDE for compilation.You should try to install the "VS-Add-In":http://qt.nokia.com/downloads/visual-studio-add-in and see if you can use it.
Are you planning to use Qt's designer for gui stuff?
-
You should also know that you cannot just run nmake in the directory of your project. You should first run @qmake ProjectName.pro@ It will generate Makefile from your ProjectName.pro file.
Actually, I would recommend to use Qt Creator as an IDE for developing with Qt. I personally find it very handy (much more handy than Visual C++ IDE). You will only need to install CDB in order to debug application, compiled with MS VC++, in Qt Creator (see Creator documentation for more info).
However, if you are new to Qt, it would possibly be much easier to start first with prebuilt versions of Qt Libs: just download Qt libraries 4.7.3 for Windows (minGW 4.4, 319 MB) and Qt Creator 2.2.1 for Windows (52 MB) from "here":http://qt.nokia.com/downloads, install them and start using. As you become more familiar with Qt, you will find no problems in building either Qt Libs, Qt Creator or your application with every supported toolchain.
-
[quote author="koahnig" date="1308858426"]If you are not familiar with Visual Studio and you do not require the microsoft compiler, it is certainly a good recommendation to consider Qt Creator. [/quote]
Visual Studio support of C++ is not so impressive comparing to C# or VisualBasic.NET. So, even if you’re familiar with Visual Studio, using of Qt Creator for development with Qt is, possibly, better approach.
Just personal opinion, of course.
-
I've tried to install the VS add-in, it said that express wasn't compatable.
bq. You should also know that you cannot just run nmake in the directory of your project. You should first run qmake ProjectName.pro, it will generate Makefile from your ProjectName.pro file.
But how should I create a makefile if I'm only using VC++, in which case I don't have any .pro files?
I'll consider using the Qt IDE for all of my projects that use Qt, I'm just worried about discrepancies between my Qt utilities and external libraries that they use (such as OpenGL, OpenAL, STL, etc) and other components of my game engine, such as the runtime foundation system which won't even use Qt.
So I suppose if I'm still going to be using VC++ for Qt development (if consistency is required), the question I have is how would I create a makefile for my Visual Studio project files that use Qt?
-
Work with external libraries will not depend on what IDE you use.
You need qmake and pro file because qmake will not only generate Makefile, it will as well call "moc":http://doc.qt.nokia.com/4.7/moc.html to generate a number of extra *.h and *.cpp files (this is because Qt uses some C++ language extensions that are not supported by compilers, e.g. slots and signals, advanced RTTI).
Qt supports OpenGL ("examples":http://doc.qt.nokia.com/4.7/examples-opengl.html), you can easily use STL things (though Qt has its own useful containers), you can use Qt with Boost. I see no reason for Qt not to be compatible with OpenAL. And, again, it all doesn’t depend on IDE.
I will strongly recommend you to spend some time learning Qt essentials, before you use it in your application. Qt is powerful and easy-to-use library, but it needs some effort to become familiar with. Luckily, there’re a lot of documentation, tutorials, examples and so on. This is some links:
- "Qt Documentation":http://doc.qt.nokia.com/
- "Qt Learning materials":http://qt.nokia.com/developer/learning/online/training/
- A lot of examples in _«QtDir»\examples_. They are also explained in documentation.
- And this forum, of course.
-
[quote author="AutoBot" date="1308859391"]
So I suppose if I'm still going to be using VC++ for Qt development (if consistency is required), the question I have is how would I create a makefile for my Visual Studio project files that use Qt?[/quote]You will need to create .pro file (its format explained "here":http://doc.qt.nokia.com/4.7/qmake-tutorial.html and "here":http://doc.qt.nokia.com/4.7/qmake-common-projects.html). If you use Qt Creator or VS with Qt Add-in, all this will be generated automatically.
To build your project you should then run qmake and then nmake or jom.
-
[quote author="DSav" date="1308858917"]Visual Studio support of C++ is not so impressive comparing to C# or VisualBasic.NET. So, even if you’re familiar with Visual Studio, using of Qt Creator for development with Qt is, possibly, better approach.[/quote]
I am certainly not someone trying to defend MS products by all means. However, I am using them for long time now. My experience is limited to C++ there. I have started recently with Qt Creator on Linux. So far, I have not found a very good reason to switch completely. By saying so, I have to admit it is probably a part of laziness behind. The philosopies are different and I struggle quite a bit to get things done in Qt Creator.
However, my personal recommendation is, if you have to get used to both IDEs anyhow, I would choose Qt Creator.
-
@AutoBot
you first should start with Qt documentation. Express versions does not support add ins, you can read the restrictions on the microsoft pages.Qt should be created on command line (you also need da different commandline when using 64 bit), after configure call simply nmake.
To work with express VS 2010, you have a lot of work to configure the pre runs, i.e moc, uic, and so on. It is better to work with the qmake pro-files, and use express as editor.... VcProjX creating by hand is a hard working job...So as koahnig wrote, Qt Creator is better for you. You can still use VS 2010 compiler, for debugging you need to install debugging tools from Microsoft.... And Qt Creator has "VS Addin" included.....
Or buy VS Studio 2010 professional, than you are able to work with VS Addin..
-
hi there is a way to buid a Qt project in msvc express editon..download the pdf from the link..
portfolio.delinkx.com/files/Qt.pdfin the second part of PDF procedure is given...hopefully it will be helpfull for you..