How to Configure QT Environment to work with Visual Studio 2010 - visual-studio-2010

Could you please help me how to make QT work in VS2010? step by step please :)
i installed a fresh copy of windows and i have this files:
Windows 7 Ultimate
Visual Studio 2010 Ultimate
qt-win-opensource-4.7.3-vs2008
qt-vs-addin-1.1.9
Also i'm really confused, i found many ways to do this but all didn't work. Also i don't know why some download "qt-win-opensource-4.7.3-vs2008" and then recompile it. Dose "qt-vs-addin-1.1.9" replace the recompiling step or what?
So please i need a help on how to install QT with VS 2010

The vs-addin does not replace recompiling but there's no need to recompile if you have pre-built Qt binaries (unless you want to change the configuration).
First install your pre-built binary package of Qt. If you've chosen to rebuild it, do that (you won't use the VS UI for this, it's all command-line based). Be sure you install this to a path that doesn't include any spaces in it... something like C:\qt\qt-4.7.3 perhaps.
Then install vs-addin, and start VS.
Now open the Qt menu, go to Qt options, and click Add to add a version. (You can install multiple Qt versions on your system this way if you wish.) Give the version a name of your own choosing, and specify the path to where you've installed it. Close out the options dialog.
Finally, create a new project and notice that the creation wizard has a section for Qt4 Project templates. Choose Qt application and you're well along your way.

Related

Cannot add qt version to qt visual studio plugin

I'm using Visual studio 2019 and I've added the Qt Visual Studio Tools plugin from the "Manage Extensions" window. I've installed the latest version 2.7.2.2.
When I try to add a Qt version, in Options->Qt->Versions, I'm able to add the Qt that I've installed (that I use with CMake etc, so I know that's working), and I save it.
When I save, close and reopen the same window, the version disappears, like the plugin is not able to save the configuration.
I'm not able to find any logs that tell me what did wrong, so:
Where can I find logs for checking the error when trying to add the Qt version?
Where the configuration should be stored?
If I know where the data are stored, I can try to add the configuration manually instead of using the GUI, hoping that it will fix the problem.
i came across the same error. Then if you look at the 'output' of VS when you click ok after setting the QT version, you may see the same error message saying that qt license is not found. Try download the license file from QT, rename it as .qt-license, and put it under c:/Users//

How do I use Qt in my Visual Studio 2015 projects?

We have large project that used .NET Framework for showing forms/windows. Recently I decided to deprecate CLR dependency and move to Qt.
While learning Qt, we've migrated from Visual studio 2013 to 2015 and then I noticed that there is no qt support for MSVC 14 version which vs2015 use.
Additionally, Qt vs addin was not working jn visual studio express/community edition we use. Is there any chance for me to use Qt and qt addin in our projects?
Searching web did not help, and it looks like no one use Qt with latest Visual Studio?
Building
You can use Qt in Visual Studio 2015 without any problems. As already stated in the comments, you have to build it from source but Qt is pretty straightforward to build. You can download the current (5.5) sources here and then follow this step by step example on building it.
I would also suggest reading more about the configure options, this might save you a lot of time. It might possibly save you some external dependencies as well if you skip components you do not need. My configuration for instance contains -skip qtwebkit -skip qtwebchannel so I do not need ruby or python.
I could totally omit step 3 from the link. Just be sure to open the Visual Studio Command Prompt (32/64 is important here) for configure and nmake.
Usage
For Visual Studio 2015, the Qt Add-In is not available anymore. But there is an Extension (Tools > Extensions & Updates) called Qt5Package or QtPackage which has the same functionality. After installing it, you have the Qt entry on your main toolbar where you have to specify a version and the path to the directory where you built it. This version will also be associated with the current project via the same menu.
If you load an existing project, you also have to convert it so the whole Qt functionality is used automatically. You can do this by opening the solution and right click on it; there should be an entry for the conversion to a QtAddin generated project.
I am using Qt 5.5 on Visual Studio 2015 with an old project and it is working without any issues.
As of now, you can just download Qt for Visual Studio 2015. Here.
Qt have finally added support for Visual Studio 2013 and 2015 although it's only in beta right now. See QTVSADDINBUG-404 for progress and read the blog post From Visual Studio Add-In To Qt VS Tools (Beta).
The Qt Windows could be added to the current project by copying all relating necessary files from the Qt stand-alone project to the current project. Specifically, the following steps must be conducted carefully.
Create an example project of Qt inside a Visual C++ project by using a Qt Plugin Program. The windows must be designed inside this project carefully before adding to the existing project.
Inside the existing project, add carefully the file heloqt.cpp, helloqt.h, ui_helloqt.h, qrc_helloqt.cpp, moc_helloqt.cpp in case of the Qt Project having the name of helloqt.
Add some configurations of Additional include directories and Additional library directories and Additional Dependencies into the existing project.
Compile and add some required *.dll files for running the program.
I have to do that because I want to use a graphic user interface in my big project, and this project is too big to be added into the Qt project inside the Visual C++ Studio.

Qt Visual C++ Add-in No Default Version Found

I am at my wit's end trying to configre Qt. I have finally got it built with MSVC++2010, but I'm having trouble with the add-in. I'm getting the "no default version found" error despite the fact that I have set a path to what I believe to be the right place in C:\Users\Aaron\Downloads\qt-everywhere-opensource-src-5.0.2\qt-everywhere-opensource-src-5.0.2\qtbase
Is this the correct place? If not, what file am I trying to link VSC++ to? Is it the qmake?
Thanks
Search your qt build for qmake.exe. The path to that file is what the Qt Add-on is looking for.
You might also need to end it with a backslash.
http://qt-project.org/wiki/QtVSAddin
Hope that helps.
Alright, my problem was that I had the wrong version of Qt installed. I was using everywhere-Qtopensource. I downloaded Qt for VS2010 and linked the add-in to that version's makefile and it worked fine.
For me the problem was I was adding the wrong directory, I tried to add the bin directory, then i tried to add the QT directory. The directory to be added is the C:\QT\QT5\5.7\msvc2013_64 directory, or whatever they are calling it today.
Note I had to update visual stupidity, then install the latest "QT visual studio tools".
Then I found that these studio tools don't have the core QT build utilities - such as qmake, for instances, so I had to install the QT Unified installer for windows, then be sure that the MSVC 20xx 64 bit version is selected. I didn't need the rest of it, and i certainly don't need 58GB of garbage.

How to deploy a Win32 API application as an executable

How can I deploy my Win32 application as an EXE application so that others (who don't have VC++ installed) can use it?
I am using VC++ 2010 on Windows 7.
If you switch to "Release" mode when you compile your finished program (rather than "Debug", which you use for debugging it during development), you should get an executable that will run on a computer without Visual Studio installed.
However, that executable will still require the appropriate version of the C runtime library to be installed. For example, if you developed it in Visual C++ 2010, you will need version 10 of the CRT installed. This is a freely redistributable library, downloadable here.
So, you have several options for deployment:
Manual Deployment
Give people the bare executable file, and include the installer for the redistributable in another folder on the installation media. If they copy the executable to disk and cannot run it because they get an error message, they should install the CRT libraries from the included redistributable installer. Then the executable will run just fine.
This works great if you have relatively a computer-savvy audience, or you're deploying to a fixed range of machines (like across a school or corporation). But it doesn't work so well for general deployment to customers.
In fact, you don't even need the installer. You can just place the CRT DLLs in the same folder as your executable and it will run just fine. This is how I test apps I'm developing on clean VMs. It works like a charm. There's no need to run the CRT installer at all. You'll find these required libraries as part of your Visual Studio installation:
<Program Files folder>\Microsoft Visual Studio 10.0\VC\redist\x86
Automated Deployment
Create a setup program that automatically installs your application along with any dependencies it requires, including the CRT redistributable. This is what you see most commercial applications doing. I recommend it for anything but the most trivial of apps.
Full versions of Visual Studio 2010 (i.e., not Express versions) can create a Setup Project that you can customize as needed to work as an installer for your application. But this is no longer the recommended way to create an installer, and this functionality has been removed from the latest version of Visual Studio, 2012.
So I recommend using something else, even if you have an older version of VS where the Setup Project is available. No point in wasting time creating something you'll just have to update later. My personal favorite choices for creating setup programs are WiX and Inno Setup. Both are free, and extensive documentation is available online.
Creating simple setups that don't have to do very much is really quite straightforward—this is likely the case for you, as all you need to do is install the CRT redistributable if it is not already there. I'd be willing to bet money you can find a walkthrough or example online for how to do this in either WiX or Inno Setup.
If you need to do more complicated stuff, both of these setup packages support it. They are extensively customizable and very powerful, it just takes more work to get it all going.
Static Linking
If you absolutely need to be able to distribute a bare executable that is guaranteed to simply work when double-clicked, you will need to switch your project to statically link in the required runtime libraries. This means that all of the CRT code is actually embedded by the linker directly into your executable, and means that you don't have to redistribute the CRT libraries separately.
The disadvantage of this approach is that the only way to benefit from improvements, bug fixes, and security patches released for the CRT is to recompile and redistribute your application. If you dynamically link (the default), your app will automatically benefit from enhancements to the installed version of the CRT libraries. Microsoft strongly recommends against static linking.
To switch between these modes in Visual Studio, follow these steps:
Right-click on your project in the Solution Explorer and select "Properties".
Ensure that the "Release" configuration is selected in the drop-down box at the top of the dialog.
Expand the "C/C++" item in the TreeView, and select "Code Generation".
Change the setting of the "Runtime Library" option to "Multi-threaded (/MT)".
A further description on what these cryptic compiler switches mean and which ones you should use when is given in my answer here.
Final Note: The "Debug" versions of the CRT libraries are not redistributable, but that doesn't matter because you should always distribute the "Release" build of your app anyway, never the "Debug" build.
In general, the odds are pretty good your EXE file will run on any version of Windows you built it on or higher.
All bets off, for example, if you built using Visual Studio 2012 Professional on Windows 7, and you try to run it on Windows 95. But otherwise, you're probably safe :)
The best way to test if you have any dependencies is to install and run on a "clean machine".
The best way to get (and reuse) a "clean machine" is with a VM.
I recommend VMWare. But Virtual Box and Windows Virtual PC are also viable choices.
As far as an installer, I'd strongly encourage you to look at InnoSetup
I hope that helps!
Make sure you build in release mode. As Floris Velleman said, you're using unneeded libraries for standalone executable.
For more information, you can check Compiler Options (MSDN).

Generating redistributable Visual Studio project with cmake

is it possible to generate Visual Studio projects that are redistributable with CMake?
The project file in question are examples/demos of our library. We don't want that our customers have to install cmake (and learn what to do with it) just to compile a few examples.
The problem with CMake generated project files is that they contain absolute paths (relativeliy easy to fix with string replacement) and references to CMake files (e.g. in prelin step. This is not easy to automatically change).
Does CMake provide an easy way to solve this problem?
Thank in advance
Yes,
you can have a cMake project, and generate Visual project on windows, XCode or makefile for other plateforms.
You use it for development, and after use install package makers like iceberg on mac, or scripts based installers on linux, or other installer creator on PC.(inno setup I think could be a solution)
Good luck

Resources