Zetrova
Zetrova

Reputation: 11

Setting up Qt 5 with Visual Express C++ 2012 on Windows 7 32 Bit

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:

  1. 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)

  2. 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.

Upvotes: 0

Views: 596

Answers (3)

Zetrova
Zetrova

Reputation: 11

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.

Upvotes: 1

Zaiborg
Zaiborg

Reputation: 2522

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

Upvotes: 0

Frederik.L
Frederik.L

Reputation: 5620

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:

  1. First, it is required that your QT5 version is msvc2012. Otherwise, it won't work. Make sure that a folder called msvc2012 exists.
  2. Create a QT5 project file (.pro) that represents your current headers and definitions. Make sure that the TEMPLATE config is set to vcapp.
  3. 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.
  4. 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

Upvotes: 0

Related Questions