Setup qmake for Qt Creator on Mac - qt

I installed the qt debug and release libraries and qt creator.
I can't make it build because of qmake. How can i make qt creator know of qmake?
I went to Preferences->Build&Run and click Add but I can't select anything, not even qmake after I find it.
I have qmake, I can run it from the command line but I can't make the QtCreator know about it.
Please help me, I feel like I'm gonna blow up.
Thanks

What I did was browse a file in /usr/bin (which is hidden in Mac OS X) which set the default folder that comes out in the file explorer to /usr/bin. Then I browsed for qmake which drove me in /usr/bin so i can select qmake. That's a workaround however.

On qt creator 4.1.0, open the Build&Run Preferences.
Under Qt Version click "Add" and hit:
Command + shift + G
and then type: /usr/local/bin (or whereever your qmake is: find qmake)
In order to see the new qt version in Kits you need to hit OK and re-open the Preferences window
I use Mac version 10.11.6 and it worked for me.

I believe it's an ownership issue. Try chown on /usr/bin/qmake and re-try Adding to Qt Versions.

Related

Why doesn't Qt Creator recognize a Qt installation directory?

I just built Qt 5.15 and Qt Creator (on Mac OS). On first launch, Qt Creator prompts you to "Choose Qt installation."
By default (on the Mac), Qt installs to /usr/local/Qt-(version). But neither this nor any subdirectory appears to be recognized as an installation directory by this dialog.
qmake -query returns the following, none of which appears to be acceptable as the "installation" directory. Nor does the directory where qmake resides.
QT_SYSROOT:
QT_INSTALL_PREFIX:/usr/local/Qt-5.15.0
QT_INSTALL_ARCHDATA:/usr/local/Qt-5.15.0
QT_INSTALL_DATA:/usr/local/Qt-5.15.0
QT_INSTALL_DOCS:/usr/local/Qt-5.15.0/doc
QT_INSTALL_HEADERS:/usr/local/Qt-5.15.0/include
QT_INSTALL_LIBS:/usr/local/Qt-5.15.0/lib
QT_INSTALL_LIBEXECS:/usr/local/Qt-5.15.0/libexec
QT_INSTALL_BINS:/usr/local/Qt-5.15.0/bin
QT_INSTALL_TESTS:/usr/local/Qt-5.15.0/tests
QT_INSTALL_PLUGINS:/usr/local/Qt-5.15.0/plugins
QT_INSTALL_IMPORTS:/usr/local/Qt-5.15.0/imports
QT_INSTALL_QML:/usr/local/Qt-5.15.0/qml
QT_INSTALL_TRANSLATIONS:/usr/local/Qt-5.15.0/translations
QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
QT_INSTALL_EXAMPLES:/usr/local/Qt-5.15.0/examples
QT_INSTALL_DEMOS:/usr/local/Qt-5.15.0/examples
QT_HOST_PREFIX:/usr/local/Qt-5.15.0
QT_HOST_DATA:/usr/local/Qt-5.15.0
QT_HOST_BINS:/usr/local/Qt-5.15.0/bin
QT_HOST_LIBS:/usr/local/Qt-5.15.0/lib
QMAKE_SPEC:macx-clang
QMAKE_XSPEC:macx-clang
QMAKE_VERSION:3.1
QT_VERSION:5.15.0
Does anybody know what this thing is looking for? Thanks!
This dialog appears to be unusable for this task. The documentation is also incorrect or incomplete.
To point Qt Creator to a self-built Qt installation, you have to go to its Preferences / Kits page and press Add; then you navigate to the Qt installation directory, go into the bin subdirectory, and select the qmake executable as Frank points out.

Qt installed on Mac but not in /usr/include

I have installed QT5 by the QT Installer from the official website and QT4 with command line $ apt-get install qt4-mac. Both have been successful but I can't find qt on /usr/include/. I have QT5 installed for sure, since I have QT creator and I can run some examples.
Here is a screenshot of my QT Preference.
http://postimg.org/image/vaus93ect/
http://postimg.org/image/q5tdc4rhn/
I searched but everybody who had installed QT have found it in /usr/include.
Thanks
PS : I work on Mac OS Yosemite. And unfortunately I am trying to make it work with Eclipse CDT but since I don't find libraries in /usr/include I can't get it work
/usr/include belongs to the operating system. Nothing that you ever manually install should touch that location, unless it comes from Apple.
You've got Spotlight, simply press ⌘-Space, type Creator, wait for it to find it, press ⌘-Enter or ⌘-Click on the result and a Finder window will open up, showing you where the Qt Designer's bundle is. That's likely where the rest of it will be. It's OS X, things are supposed to be easy :)

Get Qt5 up and running on a new Mac

Coming from Ubuntu I bought a new iMac and tried to setup my Qt development. Everything else is already up and running. Xcode command line tools are also installed.
Because it surprised me how good brewand brew caskworked I wanted to install Qt5with them. On the one side it is very fast and I do not have to got to any homepage in order to download it. On the other side I do not have to care about the installation directory. Having multiple version installed should also be a lot simpler though.
I used the following commands:
brew install qt5
brew cask install qt-creator
Qt5 is now installed under /usr/local/Cellar/qt5/5.4.1. I also added the bin folder to my path (done in .bash_profile). QtCreator, Linguist and all the other applications are shown in my launchpad. But unfortunately, it is still not done.
QtCreator says that no version of Qt is known. I tried to add qmake but I was not able to navigate to the folder mentioned above.
Could anybody give me a hint on how to fix this issue? Installing qt via installer should be the last option.
I had similar issue with Qt Creator, now on Mac GUI applications do not have access to environmental variables (in previous versions it was different).
You need to setup path to qmake in Qt Creator manually using Command-Shift-G in Finder to navigate to Folder you need.
Another option is to use brew link qt5 --force, which will symlink the various Qt5 binaries and libraries into your /usr/local/bin and /usr/local/lib directories. This will give you qmake at the command line, without requiring you to add anything special to your path in .bash_profile. The main reason this isn't done by default is that Qt4 is also somewhat popular.
It could get a little messy, but if you need to install Qt4 as well, you can unlink Qt5 at any time, by doing brew unlink qt5, and it will keep the installation intact. Then do brew install qt to get Qt4, which unlike the brew installation for Qt5 will indeed create the links directly into /usr/local without you having to manually do brew link qt. You can unlink Qt4 and relink Qt5 (or vice-versa) whenever you need to switch.
In my cases I needed to set it in Preferences => QT Versions => Add. Environment variables also did not help. Small popup when starting app also did not work.
I use command like this:
brew install qt#5
and. success install qt5 by brew.

qtcreator examples not enabled

I installed qtcreator on a Ubuntu 11.10
sudo apt-get install qtcreator
the versions installed are: QT Creator 2.2.1, QT 4.7.3
When i start qtcreator, to explore QT C++ examples the button is greyed out/disabled and it says Examples not installed.
Neither does qtdemo show any demo/documentation?
Do i have to install examples, doc separately? If yes, how?
How can i enable examples in qtcreator and documentation in qtdemo?
EDIT:
In response to one answer below from #Murtuza Kabul, I tried many things to point qtcreator to correct qt but could not. So I did uninstall qtcreator and qt-sdk and reinstalled qt-sdk. So now qtcreator is what comes with qt-sdk . It still says examples not installed.
I downloaded Qt 5.1 directly from qt-project.org and installed as admin (with sudo) on Linux Mint 12 (based on Ubuntu).
If I started qtcreator as normal user I didn't have examples but if started qtcreator as admin (with sudo) I had all examples.
My problem was with examples folder privilages. It was the only folder without read/execute privilage for all users (/opt/Qt5.1.0/5.1.0/gcc/examples). All other folders inside (and outside) examples had privilages for all users.
EDIT:
I forgot to say - as HostileFork mentioned in comment - sudo chown -R +rx /opt/Qt/5.1.0/gcc/examples was solution to this problem.
EDIT:
As noted by Climax - it should be chmod instead of chown
sudo chmod -R +rx /opt/Qt/5.1.0/gcc/examples
You also need to install qtsdk. It comes with the examples and binaries required to run the qt project. If you install the sdk, it will provide you an interface to update the sdk and install/uninstall different parts of the sdk whereby you will be able to choose if you want to install the examples or not
Install the qt4-demos package.
sudo apt-get install qt4-demos
I found the sample code installed in /usr/lib/qt4/demos/. Also the qtdemo program was installed at /usr/lib/x86_64-linux-gnu/qt4/bin/qtdemo.
It seems only a limited set of examples are installed by this package.
I had the same problem on Windows 7.
How I solved this:
I open QT Creator.
I select menu-option [Tools]
From there I select [Options...]
From there I select the [Kits] option on the left-hand side
I select the tab [QT Versions]
I click The [Add...] button: to add the QT version that I am using...
... I am presented with a windows-explorer screen to select something...
... I go to the main directory on which QT is installed (in my case: C:\Qt)...
... In the explorer "Search" I enter qmake (without the quotes)...
... There is a single qmake EXECUTABLE file displayed - I double-click it!...
... I press [Apply], then [OK].
Walla - it works! I now have examples!

Qt Creator needs a compiler set up to build. Configure a compiler in the kit options

I Have Installed Qt Creator5 with latest binaries.
but when i am running any program it is giving me this error.
:-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.
i have searched the whole internet for answer but its inadequate and not helping.
kindly reply the way to get rid of this error.
i was also having the same problem so what i did is
For linux
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
and then closed the qt creator and restarted it and it worked
i do not know which of the above two made it work but it worked !!
For Windows
Below given solution have worked for few people. so it is worth a try.
Delete this file
C:\Users\AppData\Roaming\QtProject\qtcreator\toolchains.xml
to solve the problem.
For me on Windows 7 this was solved by clicking on the arrow icon next to the computer icon on the bottom left of the Qt Creator screen above green arrows and then double clicked a compiler on the list and rebuild the project.
* for windows users only *
Before continuing to next steps make sure u have downloaded latest version of Qt.
Download and install minGW-64-bit from link:
https://sourceforge.net/projects/mingw-w64/files/latest/download
Remember The directory to which you install minGW.
Open Qt creator and go to tools -> options -> Build and Run
In Compilers tab Select add -> MinGW -> Name: MinGW path: Browse for mingw-w64.bat (you will find this file in the directory in which you have installed MinGW).ABI: x86 Windows msvc2015 pe 64bit Don't forget to apply your edits.
Go to Kit -> add Name: GCC Device Type: Desktop Device: Local PC (Default for desktop) Compiler: minGW Qt Version: select newest version Apply changes and restart qt
While creating new project make sure you use GCC as kit
If it still doesn't works Click computer icon on bottom left above play button -> GCC -> Build
OR
Go to projects (It is in the menu on left hand side) -> Build Steps -> make -> Override minGw31-make.exe -> browse to path in which you have installed minGW/bin\mingw32-make.exeDo the same for clean steps too
If u Still get any error after these steps try setting Environment Variables
Press Win+Q
Type " Environment variables "
click on " Edit the system environment variables "
System Properties -> Advance -> Environment Variables
Click on path (NOTE : Use These steps very carefully and do not mess with other options)
Click edit
press right arrow to go to end of text
type a semi-colon (if it isn't at the end of it because all the system paths are distinguished by a semi-colon)
paste path "MinGW_installation_directory\bin" (In my case it was "G:\Qt\Tools\mingw32\bin"). Make sure you copy and paste CORRECT path
Click OK and apply the changes.
That should do it !!!
user2304430 has it right, I struggled also figure it out. Above the green Run/Debug buttons in the bottom left, there's a computer icon with a pop-out menu. In there, you have to select your kit.
I went in circles for half an hour checking that my kits were set up right in options. But you actually have to select the kit in the Computer Icon -> pop-out menu in the bottom left before it does anything.
Amazingly, the first many Google pages for the error don't show this, you'd think almost all new users run into this.
I had a similar issue when developing on my Mac -
I was trying to do desktop development with QT creator 3.3.0 based on QT 5.4.0 (Clang 6.0 (Apple)) on OSX 10.9. After trying to manually modify my kits to use GCC, G++, and CLANG. I finally found this really simple solution:
Delete the xxx.pro.user file and then restart QT Creator. It should then automatically pick up your compilers/environments.
Had the same issue on Fedora 22 after installing Qt5.5.
Installing the following packages did the trick:
sudo dnf install gcc-c++
sudo dnf install mesa-libGL-devel
When I installed Qt into folder ~/Qt/ and then manually renamed the folder into something other, I had similar problem. When I restored the folder name into the original ~/Qt/ (specified at the Qt installer), the problem has disappeared; all was solved.

Resources