[SOLVED] Qt5 creator and Qt5 with Visual Studio 2012
-
wrote on 31 Jul 2013, 19:54 last edited by
Hello, I've installed Qt5 on my PC (Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB) and installed it. It created folder Qt 5.1.0 in my menu and submenu MVSC 2012 (64-bit) which includes Designer, Assistant, Linguist and cmd Qt 5.1.0 64-bit for Desktop (MSVC 2012). So up to now I can use Qt5 Creator and do stuff in Qt. But I'd like to use Visual Studio 2012 Ultimate and use Qt Designer.
So my questions are:
- Can I have Qt Creator and Qt with Visual Studio on same PC (I was always using Visual Studio, so did not download Qt Creator). So when I want to do in Qt5 I just open creator, and when I want to do stuff with Visual Studio I just open VS.
- If answer on first question is YES -> How to compile it ? (On one of my PCs I did it with github, but how to do it here when I already have installed Qt5???, Do I have to download it from github again, will it overwrite my current Qt)
If answer on first question is NO -> That means I have to reinstall it and use only with VS???
I would like to keep both. Sometimes I need just to test some stuff with Qt Creator and most of the time I need VS and Qt Designer.
Thanks in advance
Edit: Ohh... I just noticed this is Qt Development thread and not Installation. Can admin or mod move it to the right section please???
-
Hi, welcome to devnet.
Qt is a library. How many different IDEs you have installed is of no concern.
The package you installed includes both Qt compiled for VS2012 and IDE (QtCreator) but you can use it in whichever IDE you like - Creator or VS.That being said, you don't need to compile Qt again. It is already compiled and ready to be used with VS.
VS on the other hand knows nothing about Qt so you need to "tell it". You do that by installing "Qt VS Add-in":http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.2-opensource.exe and configuring your Qt installation there. It will also add handy VS templates for new Qt application and take care of calling appropriate Qt tools on compile time (moc, uic etc.). -
wrote on 31 Jul 2013, 20:24 last edited by
Oh, I did not know it's so easy.
Thank you for your fast response.
-
wrote on 31 Jul 2013, 20:31 last edited by
Hello, I am back. I installed Add-in and now I am getting errors in VS. When I want to start new Qt Project at Project settings I recieve first error and after I press Finish it says "Unable to find Qt Build".
!http://img832.imageshack.us/img832/3293/9ha9.png(First error)!!http://img35.imageshack.us/img35/8563/0aiw.png(Second Error)!
-
wrote on 31 Jul 2013, 20:37 last edited by
I opened Qt Settings in VS and set Path Variable and it's working now. But now I have new problem. I am trying to test plain project to see if UI window will appear and it fails to build with following error : Module machine type 'x64' conflicts with target machine type 'X86'
-
As I said - you need to configure your Qt installation in the add-in. Notice that a new QT5 menu appeared in VS. Open it and hit Qt Options. In the Qt Versions tab add new entry, call it whatever you like and give it the path to the folder where you have your Qt installation. Hit ok and that's it. Now you should be able to create new Qt app with VS.
-
The package you installed is for the x64 version of the compiler. VS by default creates 32bit pprojects so you need to switch to the right configuration. Next to the "Auto" and "Debug" combos in the middle of the toolbar there's a "Win32" combo. Switch it to "x64".
Next - right click on your solution in the solution tree and select "Change Solution's Qt version". Select the version you added and hit ok.
Now you should be able to compile and run. -
wrote on 31 Jul 2013, 20:47 last edited by
So I fixed problem with "Module maschine type..." with this step Project Properties->Configuration Properties->CUDA RuntimeAPI->Host set the "Target Machine Platform" to x64.
But now having another error -> There's no Qt version assigned to this project for platform x64. Please use "change Qt version" feature and choose valid Qt for this platform
-
wrote on 31 Jul 2013, 21:07 last edited by
Next – right click on your solution in the solution tree and select “Change Solution’s Qt version”. Select the version you added and hit ok.
Now you should be able to compile and run.This fixed my problem, everything works fine now. Thank you
-
Great, glad I could help.
Just about your previous fix - changing the platform. You probably created weird (although working in this simple case) configuration - 32bit configuration with x64 target. You should revert that and just switch the combo I mentioned. This will save you some weird problems in the future. -
wrote on 31 Jul 2013, 21:16 last edited by
I will check, thank you.
1/11