How to use Qt Creator with Visual C++ compiler on windows? - c++

I installed Visual Studio 2008, Qt 4.8 libraries for vs2008 and Qt add in. I can build Qt projects in VS2008. But it's very inconvenient for me. When I open Qt project in Qt creator it can't compile because can't find qmake.
So, how to build projects using Qt Creator on windows.

Use CMake to build your software. With CMake you can:
-Build your project on a continuous integration server
Compile with different compilers (Microsoft, gcc, clang) to get additional static checking.
Open the top level CMakeLists.txt with creator as a project file.
Have CMake create Visual Studio project files.
If you want to fix Creator only:
Qt Creator needs to know where your Qt installation is. Choose the green Qt symbol in the settings menu, klick Qt Version and enter the path to qmake. Then Qt Creator should be ready to go.

hope this will help its having easy steps with some solution of errors that one may encounter during installation http://qtitkvtkhelp.blogspot.in/2012/11/qt-installation-prerequisite-1.html

Related

Why Qwt extension does not work in Qt Visual Studio?

Im currently woking in Visual Studio 2022 with Qt extension with MSVC 2019 Qt version 5.12.2 x64. I succesfully executed qmake in Qt Creator 6.4.0 and obtained build (msvc2019 x64) release folder. Then I ran nmake and nmake install which got me Qwt-6.2.0 folder in my C drive with doc,features,include,lib and plugins folders. I also added qwt_designer_plugin.dll to plugins designer. After that I tried to add qwtPlot in Qt designer but when I ran programme I get this error message:
Error message
I tried to add libs and include files via project properties but nothing worked at all. Any suggestions please?
I figure it out myself. Note that Qt (as least up to the 5 releases) have a consistent naming of their files, modules and libraries: With or without a d suffix. If a DLL have a d suffix (like Qt5Cored.dll) then it's a library for debug builds, make sure you build with the debug libraries for your debug build.
So you just add qwtd.lib for debug and qwt.lib for release in Additional Dependencies.

Export Visual Studio project to Qt Project

I would like to export my Visual Studio Project to a Qt project.
How to generate a .pro file from a Visual Studio Project? I installed the Qt Add-In but I don't find such option.
With Visual Studio Qt plugin installed (officially named Qt VS Tools, can be downloaded from here), just:
Open your solution.
Select any Qt-based project from your solution (or any file within that project).
Go to menu Qt VS Tools > Create basic .pro File.... If you are using an old version of the plugin, menu may be named Qt5.
Select the projects you want to export. Project tags (.pro options, only in newest plugin versions) are automatically extract from your current project, you can modify them if needed or do it later when the .pro is created.
Run qmake or open it from Qt Creator.
PS: depending on your VS and Qt versions you may need an older version of the plugin. I'm assuming Qt 5 here.
Hope it helps.

Qt installation

I am completely confused in installing Qt.
Do I need to download both Qt creator and Qt SDK or Qt.exe?
I have Visual Studio 2010 and Code::Blocksin my PC. So, how can I link if any one of the Qt XXXX listed above with VS-2010 or with Code::Blocks?
Please help
You can download QT creator from http://qt-project.org/downloads for windows you will get a .exe (you will find different .exe for VS Studio and mingw, so you can use what you prefer), once you install it you got
Qt libraries, prebuilt for a particular development platform (operating system
and compiler)
Qt Creator integrated development environment (IDE)
Basic development tools, prebuilt for a particular development platform
Documentation
Some more help.
You can start Qt Creator directly after the installation by selecting the option
on the last page of the installation program. You can start most of
the development tools, such as GUI designers, compilers, and debuggers
directly from Qt Creator. You can also access the installed documentation and
example applications from Qt Creator.
You can open most example applications in the Qt Creator Welcome mode to build
and run them. Additional examples can be opened by browsing
(install_dir)/(version)/(compiler)/examples.
To develop a Qt application, you need to set up a project. Qt Creator contains
wizards that guide you step-by-step through the project creation process. The
wizards prompt you to enter the settings needed for a particular type of project
and create the necessary files for you. To start, select File > New File or
Project.
The wizards create projects that use the Qt build tool, qmake. It is a
cross-platform system for build automation that helps simplify the build process
for development projects across different platforms. You can modify the build
and run settings for qmake projects in the Qt Creator Projects mode.
Qt Creator provides support for building, running, and deploying Qt applications
for different target platforms, or using different compilers, debuggers, or
Qt versions. Kits define the tools, device type and other settings to use when
building and running your project.
The Qt installation program adds the installed Qt version
((install_dir)/(version)/(compiler)/bin/qmake) to Qt Creator and creates a kit
that specifies the installed Qt version and compiler. To use the kit, add it for
your project in the Qt Creator Projects mode. Then select the kit in the Kit
selector before you build or run the project.
To compile C++ Qt applications by some other means, add
(install_dir)/(version)/(compiler)/include to your build tool's search path
for include files, and (install_dir)/(version)/(compiler)/lib to the search
path for libraries.
To work with Visual Studio 2010, you can download the installer "Qt 5.0.1 for Windows 32-bit (VS 2010, 481 MB)", or just download the source code and build it yourself (you'll need to do that if you want 64-bit versions of the libraries).
"Qt Creator" is Qt's IDE, so you don't need that. You just need the "Qt Library" to use Qt with other IDEs. For Visual Studio, you'll also want to download the "Visual Studio Add-in," which allows you to view Qt data structures in the debugger.
The free downloads are available at qt-project. Commercial downloads are on digia.

Qt Creator with Visual C++ 11

I want to use Qt Creator with MS VC++ 11 but it says there is no toolchain to build Qt.
I installed Qt with the full SDK installer.
What to do now?
Isn't MSVC++ 11 comes with Visual Studio 11? If so then Qt hasn't supported makespec file for that version AFAIK (correct me if I am wrong). But following are the (rough) steps for running Qt Creator with MSVC 2010 nmake/cl tool-chain..
Download Qt SDK 4.8.2 compiled using msvc-2010 toolchain from this site (second page).
Install MS VC++ 2010 free development tools (or full SDK), which comprises of nmake/cl/cdb executables.
Restart PC so as to initialize environment variable and all.
Start Qt Creator, by now you will notice msvc-2010 tool-chain has been identified by Qt Creator (Tools -> Options Dialog). If not then manually add it.
Also confirm that Qt version 4.8.2 of msvc-2010 has been identified in Qt Versions tab. If not then manually add it by giving path of qmake in bin of Qt SDK folder. It will also select msvc-2010 tool-chain automatically.
Here you go, now go to Projects and in Build Settings, select msvc-2010 tool-chain and compile. Make sure win32-msvc2010 is selected as makespec file.
Hope this helps.
try building using the makespec of Visual Studio 2010.
SET QMAKESPEC=win32-msvc2010
before running configure and qmake should do the job

Simultaneous development in Visual Studio and Qt Creator

I'm going to develop a bunch of projects with Qt that should compile both under Visual Studio with Qt integration (commercial) and Qt Creator with LGPL SDK. My primary IDE is VS but I've grown to like Qt Creator too. It would be nice to be able to work in both of them simultaneously. I need to do it in some extent anyway.
The most annoying problem is project management. Should I create .pro file first and then import it to VS? Or should I create VS project first and create .pro file by Qt integration utilities? What's the best way to do it?
I would like to hear your ideas on the subject.
I use the .pro files as a basis and create VS projects from them. Using scoping rules I can set options that are specific for the VC++ compiler or the MinGW compiler. I haven't encountered any VS option yet I couldn't specify in a .pro file. OK, make that one: trying to set the warning level to 4 (win32:QMAKE_CXXFLAGS_DEBUG += /W4) didn't work because /W3 was still present.
For adding new files to the project I sometimes just add them to the .pro files and setup the VS project again. That way I don't have to worry about keeping both in sync.
Using this approach makes it easy to do automatic builds under a variety of compilers (Microsoft, Intel, MinGW, 64bit cross compilers)
Do you mean Qt Designer or Qt Creator? Qt Designer is the form builder, Qt Creator is the IDE.
I would recommend delegating your project management to CMake. Qt Creator now has support for cmake. cmake generates you project files based on a simple set of description files. I now use cmake even if I am just using visual studio because it is much easier to manage common settings between related projects than updating loads of settings in different dialog boxes. It also is also a multi platform build and is very clever at discovering the build tools and libraries installed on the developer system and creating the appropriate build output, make files, and ide project files.
I am glad you were able to solve you current issue QT Creator is a great tool. As much I like QT Creator and dislike Visual Studio, if you need to work with other developers on windows skipping support for visual studio in the future may not be an option.
I have had good luck using CMake ( http://cmake.org/ ) to generate my project files. I am working on a Linux/windows project where the developers can use just about any IDE and compiler. Learning to use CMake is easy, learning to make good cmake scripts takes a little time though. However, QT Creator has the ability to create the CMake projects for you, and you can customize and learn just as much of the CMake build script language as you need to.
Like this I have worked with visual studio, Code::blocks, QT Creator, clang, gcc/mingw and the vc++ compiler.
My approach was to create the project in VC++ and then export it to pro. I then tweaked all the pro files by hand and I keep them in sync by hand.
It's better to start with VC++, because VC++ has many more options that Qt's pro files.
Once you start changing more advanced options you will want to sync by hand
Make sure that both toolchains output the files in the same directories, or you might encounter issues such as moc files in your project dir that are updated only by QtCreator, while VC++ only updates the ones in GenratedFiles which the compiler can't see due to the former.
I have dropped Visual Studio for C++ development. Now I use only Qt Creator. All the troubles with parallel ways just do not worth it.