In which I setup an IDE for my coding...
As with most of my Tinker posts to do with computers this is a guide to something I might need to do again in the future. You can probably find out how to do it online but I struggled with bits and am putting it here for my own and other's reference.
I am currently demonstrating a C++ lab at the University and it's good to be able to run the example code myself ahead of time. Also I am continuing to teach myself C++ as part of Project Euler.
QT Creator is an Integrated Development Environment (IDE) which features (among other things):
- C/C++ support
- QML support - allows you to make GUIs quickly
- Cross platform compiling
- App publishing tools
- The awesome tag-line "One framework to rule them all"
You can find out more at the QT Project website.*
*QT is owned by digia who produce a commercial version. I have only linked to the open source implementation.
I am running Windows 8 Pro with Media Centre (64-bit) currently.
So running Windows 8 the QT 5.0.1 open source installer (http://qt-project.org/downloads) doesn't run at all.* This version should install everything but for reasons I couldn't fathom it doesn't install.
Assuming you don't own Microsoft Visual Studio already the free version of QT requires you install MinGW. MinGW is a minimalist GNU environment on Windows and includes GCC as it's compiler. If you want to use CMake and versioning it is a good idea to install CMake and MSysGit.
Eventually I installed QT 4.8.4 for Windows (32-bit). I then installed QT creator 2.6.2 as a standalone program.
You need to set quite a few things to get QT up and running if you can't use the full installer.
Firstly you need to set the QT version correctly. Find the directory for your version of QT and set in in Tools>Options>Build & Run>QT Version.
Secondly you need to point QT creator to MinGW. This involves messing around with your Windows environment variables:
- For Windows 8 go to Control Panel>System>Advanced system settings>Environment Variables.
- Click add new.
- Set name as MINGWDIR and set the value as C:<path to mingw> (C:mingw if you used the default settings for standalone MinGW).
- Click add new.
- Set name as PATH and the value as %MINGWDIR%bin.
- Accept changes and exit.
Secondly add in CMake in the CMake tab by browsing to the executable in Tools>Options>Build & Run>CMake.
Thirdly add versioning by pointing Tool>Options>Version Control>Git to the Git directory in C:<path to msysgit>git.
Finally you need to set your debugger correctly. I used GDB through MinGW but it didn't autodetect correctly. Point Tools>Options>Build & Run>QT Version
After all this I could compile the example code for a QML Hello World program. When I ran it this lead to a segfault. I couldn't be bothered to faff anymore (a search for "segfault QT creator" will return loads of results unrelated to the problem) and switched to Linux. I will have a look into sorting this in the future.
*Well sometimes the Windows Installer process would start but I had to keep killing it in Task manager as it didn't do anything for hours.
I am running Gentoo Linux 3.3.8 (64-bit) currently.
Make sure to update Gentoo as good practice first*:
- Run as root: emerge --sync && emerge -avuDN world
- USE="examples git jadtex cmake minizip" emerge qt-creator -avuDN†
- Add your git directory - /usr/bin/ in a lot of cases.
*Since udev had a weird update and portage needed updating and I haven't been on Gentoo for over a month this took me a while.
†Your USE flags may differ - listen to Portage, that's what it's for!
Gentoo wins! :)
P.S. I am going to pre-empt the "You should have started using QT years ago" comment from my friend Ben.