Using both mingw and msvc under QtCreator - visual-studio-2010

I want to make QtCreator able to compile with mingw and msvc but i don't know how.
I found some information over the internet but didn't work for me.
I tried by installing
QtSDK + qtvs2008 + qt visual studio addin [FAIL]
QtCreator standalone + mingw + qtvs2008 + qt visual studio addin [FAIL]
QtCreator compiled with visual studio + mingw + qtvs2008 [FAIL]
I don't know what else to try so i will need some help here.
Is this thing possible?

I have vs2008 installed. When I download the latest Qt version and create project in Qt Creator it automatically adds targets for mingw and msvc. In other words, when you install Qt SDK select "custom" install and check what components you are installing. Addons for vs2008 is included in the package.

Start with the Qt SDK. That gives you Qt Creator, the MinGW compiler, and a Qt version compiled with MinGW, and is suitable for developement with MinGW out-of-the-box. Then add a stand-alone version of Qt binaries build with MSVC, or get the sources and compile it yourself (configure.exe and nmake from a MSVC command prompt). In Creator you go to Tools->Options->Qt4 Version, and 'Add' the MSVC version by pointing the entry to the bin\qmake.exe in the MSVC version. Afterwards you should be able to switch between the MinGW and MSVC version in the Project tab. You don't need the Visual Studio AddIn.

While installing, choose custom type of installation. Selecte libraries for needed compilers in QtSDK->Development Tools->Desktop Qt->Qt-.

4/1/2016
I think maybe you need this qt online_installers. With this way, maybe you can make qt-mingw and qt-msvc work together.
Here are the configure screenshot:

Related

Building Gtk app for Windows OS - msys2 mingw vs Visual C++

Are there any advantages for building a Gtk3 app for Windows OS with the MSVC Visual C++ Compiler over msys2 mingw (ucrt64)?
Functionality-wise? Look-wise? Debug-wise?, Deployment-wise?
I'm new in a project that builds Gtk2 apps for Windows with Visual C++. No one really remembers if there was a special reason for using Visual C++.
I was asked to create a build process for the Gtk3 version.
I came up with using Mingw (ucrt64) with msys2 which is one of the ways described on Gtk Windows page.
Packaging and Build:
I installed the necessary packages with msys2 and I'm able to build the app both with mingw and with Visual C++. With mingw I can use pkgconfig with cmake. With Visual C++ It's not so straight forward - I just give it hard-coded paths.
Debug:
When building with mingw I was able to also debug with gdb (also by using VS code). I haven't tried to debug the Visual C++ build yet.
Deployment:
After the Mingw build I created some shell script to copy dlls, icons, etc.. to a release dir and I can package this this and deliver it. Is there a better way with Visual C++?

Qt on windows with mingw and no MSVC redistributable?

Qt supports compiling all including qml without MSVC. So how to install qt creator and qt studio without them, how to create qt package that will not rely on MSVC at all?
You could build QtCreator with mingw and distribute it in your classroom : take a look at the Readme https://github.com/qt-creator/qt-creator
If you cannot install MSVC redistributable run times, you can either build your own package using MinGW (see other answers, but note that you only need to rebuild Qt Creator and Qt 3D Studio, not Qt intself).
Or you can install the official packages that do depends on MSVC runtimes (for QtCreator and Qt Studio) and instead of installing the MSVC Redistributable Package, you can copy paste the required DLLs to the installation folder (e.g C:\Qt\Tools\QtCreator\bin for Qt Creator).
For Qt Creator it seems that you will need:
MSVCP140.DLL
VCRUNTIME140.DLL
You can check the missing DLLs using Dependency Walker or similar tools.
Note that if copying the DLLs around is not recommended by Microsoft, but it does work. And it is less cumbersome that rebuilding Qt Creator.
It's also possible to directly install redistributable Visual C++ DLLs
in the application local folder, which is the folder that contains
your executable application file. For servicing reasons, we do not
recommend that you use this installation location.
https://learn.microsoft.com/en-us/cpp/ide/redistributing-visual-cpp-files

Qt 5.8 msvc 2015 compile error

I have installed Qt using an offline installer qt-opensource-windows-x86-msvc2015_64-5.8.0. I have visual studio community edition 2017 installed with c++ build tools. because it's compiler was incompatible with the qt version, then I installed visual c++ build tools 2015 from http://landinghub.visualstudio.com/visual-cpp-build-tools . When I try to compile a project it gives an error :-1: error: LNK1158: cannot run 'rc.exe'. Heres how my qt kit looks like,
Can someone figure out whats the mistake and how to fix it.
Thanks.
I've fixed this both on my own machine and on several co-workers machines.
It tends to happen when you have both Visual Studio 2015 and VS 2017 installed. Or more precisely, multiple versions of the Windows SDK installed. When that happens, the vcvars32.bat script (located in your Visual Studio install dir) does not correctly add the location of the resource compiler (rc.exe) to your PATH. Thus, QT Creator runs vcvars32.bat (as specified in Qt Creator under Option->Build&Run->Compilers, but the tools directory for the Windows SDK Kit isn't properly added to the PATH environment.
The simple fix is to add the appropriate version of RC.exe to your path.
Do this from the command line:
cd "c:\program files(x86)"
dir /s rc.exe
You'll get several versions (x86 and x64) and for several versions of the SDK. Add the PATH for where rc.exe lives for the version that corresponds to the SDK and build flavor to your vcvars32.bat startup script.
For example:
PATH="C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86";%PATH%
Restart Qt Creator and that should fix it.
Another fix that worked for me is to uninstall all versions of Visual Studio (and all those side installs of SQL, Windows SDKs, dev tools, etc...). Reboot. Then cleanly install VS 2017 again. Then cleanly uninstall and re-install all of Qt again. That seemed to work for me. A wonderful way to spend an afternoon.
If you update to Qt 5.9 it supports MSVC 2017. However, if you want to get it working with 5.8, I believe you might be missing the Windows SDK. You can download the SDK from Microsoft for Windows 7, 8 or 10, just get whichever version is appropriate for you.
With some googling I found a couple of other somewhat related solutions here, & here, and I've summed them up below:
If you've already got the SDK or installed it and it still doesn't work, it appears that copying rc.exe and rcdll.dll from the WindowsSDK folder to your MSVS installs \VC\bin folder may fix the problem. You might also try copying those same two files to Qt's \Qt*version number**compiler version*\bin.

Qt 5.3 configuration error for VisualStudio 2010

I am relatively new to the Qt. At the moment I'm trying to configure Qt library for my machine before installing add-in for VisualStudio'10. I tried to download Qt library only (withouth a Qt creator IDE), and found "qt-everywhere-opensource-src-5.3.2.zip" and extracted it to my external drive: "F:\Programs\Qt\5.3.2". Then I run command "configure" on VisualStudio command prompt.
F:\Programs\VStudio'10\VC>cd F:\Programs\Qt\5.3.2
F:\Programs\Qt\5.3.2>configure
After a while it gave me following error:
Running configuration tests...
NMAKE : fatal error U1077: 'F:\Programs\VStudio'10\VC\BIN\link.EXE' : return cod
e '0x463'
Stop.
Could not find output file: No such file or directory
WARNING: The DirectX SDK could not be detected:
There is no Direct X SDK installed or the environment variable "DXSDK_DIR" is
not set.
Disabling the ANGLE backend.
WARNING: Using OpenGL ES 2.0 without ANGLE.
Specify -opengl desktop to use Open GL.
The build will most likely fail.
On the installation instruction that was found on Qt webpage, it was said to set environmental variables: "Add this 2 paths to the Environment Variables: “C:\Qt\2009.01\bin” and
“C:\Qt\2009.01\qt\bin”." But I was unable to find any "bin" directory in my qt-everywhere folder. Instead I set up following variable to my path: "F:\Programs\Qt\5.3.2\Qtbase\bin". Still no help.
How can I resolve these issues? Any ideas and help are highly appreciated.
What you've done is more like attempting to prepare building Qt itself from the source code (but that is not exactly how to do that, anyway). You don't need that at least now but when you start customize Qt framework, say, for static build. That is when configure tool comes handy. And you will need to read on that.
You need just to download its installer from: http://qt-project.org/downloads
I assume you don't have prebuilt Qt and Qt Creator in your system but that is prerequisite for what you want to do. Take either Community version or start download immediately. After you've installed certain Qt version for your platform including Qt Creator (which is native Qt IDE) you will also be able to install and use Visual Studio AddIn. And then take Visual Studio AddIn for Qt 5 from: http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe and install it. Read the instruction on how to use it. There will be some new menu for importing Qt project, though.
BTW, Qt Creator itself is not bad at all and maybe preferable for most of Qt development tasks except some debugging. I maintain entire project in Qt Creator and write the code there and only occasionally go to Visual Studio with AddIn installed to import Qt project there for some better debug experience.
you can try run "configure -opengl"
or , you can download Microsoft DirectX SDK and install it ,then try again.
http://www.microsoft.com/en-us/download/details.aspx?id=6812

Integrating Qt 4.7.2 with Visual Studio 2010

I am trying to add Qt 4.7.2 to my Visual Studio 2010. I downloaded the source code, changed the environment variables, ran a configure -no-webkit command (which ended successfully), and an nmake command (which also ended successfully). Afterwards, I installed the Qt Visual Studio Add-in 1.1.9. When in VS I go to Qt->Qt Options->Qt Versions and I add the current Qt Directory (4.7.2) it gives me this error:
This Qt version uses an unsupported makefile generator (used: MSBUILD, supported MSVC.NET)
What should I do? Thank you!
Also, I am running on Windows 7 x64 if that is of any help.
Edit: The problem appears only with VS Add-In 1.1.9. To solve simply install the 1.1.8 version. I found it on a Russian website. Works like a charm!
I did this yesterday, here's how:
Open up the Visual Studio Command Prompt, navigate to your Qt folder
execute "configure -platform win32-msvc2010 -debug-and-release -static -no-exceptions -no-accessibility -no-rtti -no-gif -no-libtiff -no-libjpeg -no-libmng -no-qt3support -no-openssl -no-dbus -no-phonon-backend -no-multimedia -no-audio-backend -no-script -no-scripttools -no-webkit"
(those were my options, you can of course change them)
execute nmake
add an environment variable named QTDIR with your Qt folder as value (had to do that because the add-in failed to do so)
now you can choose this folder to add a Qt version in the add-in
configure.exe -platform win32-msvc2010
will generate both a nmake makefile and a .sln file, build with either
you can also add
-no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -fast

Resources