Totally new to Qt and C++ (although had studied it long time ago).
I need to build a C++ Qt project. It asks for MSVC 2015. The build project file is not proper. I have no idea what to do. I installed VC redist and SDK but no success. Can someone please help me how to set up the build file so I build the project successfully?
The kit does not have compiler associated with it. and I don't know how to get it to work.
Edit: Adding attachment if I use mingw
Edit 2:
Kit configuration with MSVC2015:
What should be qmake statement?
Related
I have a Qt project(.pro) which essentially uses Qt libraries and OpenGL and i need to integrate this project with an existing VS2008 project(.vcproj) which uses a 3rd party API on another system.
The VS project interfaces with a hardware(along with many other functions) through a serial port and i intend to use its event handler to trigger the actions in Qt( since a serial port cannot be opened by two programs simultaneously? )
I use Qt v4.8.1 with mingw complier. i did come across a VS plugin for Qt. but i'm not sure as to how the above task of integration can be done.
I'll be thankful if you can kindly shed some light on this.
My advice would be to completely integrate the source of the Qt project into the VS project. It's possible to compile Qt code in visual studio. Of course, this requires to configure your VS project to make it "qt-ready". In detail:
Integrate the source code of the qt project into the VS solution. This means, the header files, the cpp files and the ui files you might have.
You still need the Qt libraries on your system in order to compile QT source with visual studio. I recommend to install "qt-win-opensource-4.8.1-vs2008.exe". These are the special Qt 4.8.1 libaries for VS 2008 (pre-compiled). Can be found here: http://download.qt-project.org/archive/qt/4.8/4.8.1/
You have to tell visual studio how to "pre-compile" the Qt source with the installed Qt binaries. This can be down in two ways:
I. You can configure the project properties of your VS project. Unfortunatelly I have never used this way, so I don't know exactly how to do this.
II. You can use CMake to setup your VS project. CMake allows the simple integration of Qt libaries and compilers. Using CMake means to write a CMakeLists.txt, which generates the VS project for you. Here you can find a sample, explaining how to write a CMakeLists.txt with Qt support: http://www.cmake.org/Wiki/CMake/Tutorials/Qt
Also, the Qt plugin for visual studio you mentioned is optional. You do not need it to build a Qt project with visual studio, but it makes some issues easier, e.g. debugging or calling the Qt designer from visual studio.
Hope this helps,
Michael
How do I exactly set up QT5 to be fully working?
I downloaded and installed:
Qt 5.2.1 for Windows 32-bit (VS 2012, 541 MB)
Visual Express C++ 2012
I ran the examples on QT Creator. They are all compiled and running fine. Simple hello.cpp also works okay
However, I can never understand why:
Running command prompt of QT or C++ native from VS will not let me do "make". qmake -project and qmake XXXX.pro is running fine. (Note: I can do compile well in QTCreator)
Subclassing cannot find its way to the folder. QTCreator complain LNK2019 and LNK1120
Could someone please list step by step on how to set these two software works seamlessly (QT5 and VS2012) from clean installation? I simply want to start coding gui with C++; nothing complex yet.
P.S. I could not find clear answer and guide regarding this matter. I can't register on QT site too (always say "no content to display" on registration page).
Anyway, thank you for the time, effort and attention.
Update: I have windows 8 at home, installed Qt5 and VS12. It works seamlessly. At work, the IT guy is stubborn to install windows 7.... Qt5 and VS12 in windows 7 is not the combo apparently. When compiling, it complains "where the hell is QDialog, QApplication, Q.... or whatever #include...?" I will try something else next week and will update you all.
Wow, what a mind blowing.
Here is the story in my Win7:
1. Installed VS2013, Qt does not like it. Then, I install VS2012. Still does not like it. Then, uninstall everything including deleting C:\Program Files\Microsoft VS 11.0 and 12.0.
2. I install VS2010 and QT for VS2010. Still not working.
Finally, uninstall and delete everything (including all folders in program files and c:\QT), I install VS2012 first then install QT for VS2012. It works....
Hope this help anyone who has problem in compiling during their first install in Win7.
Compiling a QT5 application in VS2012 can be really tricky depending on your current setup. Here's a summary of the most important guidelines to make it work like a charm:
First, it is required that your QT5 version is msvc2012. Otherwise,
it won't work. Make sure that a folder called msvc2012 exists.
Create a QT5 project file (.pro) that represents your current headers and
definitions. Make sure that the TEMPLATE config is set to vcapp.
Run >> qmake yourProject.pro in the command prompt. This should
generate a Visual Studio project (.vcxproj) file that can be openend
with Visual Studio 2012. Note: if there is more than one version of
VS installed on your system, qmake will more likely take a weird
decision and take the older one (qmake you're a bad kitty!). In this
case you must call the qmake from the VS command prompt directly.
Open the .vcxproj with Visual Studio 2012 and compile.
Any problem that may occur, for example compilation failure, is related to one of these steps being incorrectly done.
Useful references:
How to create a QMake project files, How to set environment variables
in vs2008 there is vsvars32.bat that sets up the variables to let you call make from basic cmd.exe. maybe something exists for Vs2012.
under windows systems its not make, it should be nmake
I am new to C++ and have been working with MS VISUAL STUDIO 2010 Express. However, I am in need to shift to Qt as my university recommends. Unfortunately, the qt.nokia.com is redirecting to another site http://qt.digia.com/.
Since everything in that site is not free, I found the following link called "Qt Open Source Version". Is this is the site to download Qt?
When I go there, I can see various options, which means number of downloads. I have windows 7 ultimate and got visual studio 2010 express installed in my machine. But, this site got number of windows downloads. I prefer the one which claims to come with the Qt IDE (Qt Creator??). If you need further more information, I will be using this Qt GUI C++ applications with OpenCV.
I have already installed OpenCV and it works with VS so if you can, please tell me how to set it up with Qt as well.
Please help me to download the correct version of Qt. Thanks
Answering to these kind of question is always hard and dangerous!
I know you had experiences with VS but
I'm going to offer you to choose MinGW instead.
Download link
qt-project is the correct place to get open source Qt.
There are prebuilt binaries of Qt 5.0 for VS2012, but if you want to use Qt 4.8 with VS2012 you'll need to compile it yourself, as there are no prebuilt binaries for VS2012 (yet?). Compiling Qt is not difficult, just open command prompt for VS2012, run configure --help to find out how you can customize your Qt build. Then run configure with appropriate parameters, then nmake.
If you decide to use Qt Creator as an IDE you are welcome to do it - Qt Creator can compile projects using different compilers, including VS2012 compiler. But in order to debug projects compiled with VS2012 compiler you'll either need to use VS2012 or install Debugging Tools for Windows (which Qt Creator will find and use to debug VS2012-generated executables).
http://qt-project.org/downloads
Qt 5.0
Select the file according to your operating system from the list below to get the latest Qt 5.0 for your computer. The binary packages include Qt 5.0.2 libraries and Qt Creator 2.7.0
Qt 5.0.2 for Windows 32-bit (VS 2010, 485 MB)
after finding that its too hard to write GUI applications with WIN32API today im going to learn Qt. so I installed qt as follows.
first I installed VS 2010 express. its OK.
then downloaded Qt libraries 4.8.3 for Windows (VS 2010, 235 MB) from http://qt-project.org/downloads and installed it as a normal software. (in C:\Qt\4.8.3) it automatically installed assistant, designer ... ect.
then downloaded Qt Creator 2.6.0 for Windows (51 MB) from http://qt-project.org/downloads and installed it also as a normal program.
now in qt creater when I try to creat a Qt project it says that no valide kits found.
here are some screenshots of the issue im facing.
what should I do now to start qt. please I need someones help to procced.
You don't need QtCreator AND visual studio.
QtCreator is Qt's own IDE and uses g++/mingw as the compiler (included in the download).
Qt includes QtDesigner - the graphical UI designer that you can use with visual studio or QtCreator.
If you want to use VS, install the qt-vs-addin and download the VS builds of the Qt libs.
If you want to use QtCreator, download the mingw builds of Qt.
Or in both cases you can download the source and build it from scratch using wither QtCreator or VS.
edit: You can make QtCreator use the VS compiler backend - in which case you should download the VS build of Qt. Personally I have never done this - if you are using VS then you may as well use the VS ide.
edit2: The free express version of VS can't use plugins - so its a bit of pain to use with Qt. In this case you should probably use QtCreator.
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.