Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot run qmake in Mac Terminal

Tags:

c++

macos

qt

qmake

I'm learning Qt for my C++ course at college. I am trying to set up the environment for my first assignment but I can't seem to get it right. I swear I have run qmake in the terminal before, but now since I installed Qt 5.2 with Qt Creator I can't create the projects in the terminal.

None of the commands are recognised and on top of that if I try to compile a standard C++ file with

#include <QtGui>

the compiler won't find it. The g++ compiler that I'm using will not find any of the Qt Libraries that I try to import. I looked online and the solution I found was just to run

brew install qt

in Terminal and hope that it sorts itself out, although the terminal throws an error and won't install it once it's downloaded. I really need to get this working for my assignment.

Any help would be greatly appreciated. Thanks in advance!

* EDIT *

Okay so I added the qmake bin into my PATH variable. This was the path:

/Users/#####/Qt5.2.1/5.2.1/clang_64/bin

The problem is that now nothing in my C++ source files are being recognized. None of the imports like QString or QTextStream or QtGui, etc. What can cause this?

like image 991
Nick Corin Avatar asked Mar 01 '14 15:03

Nick Corin


People also ask

Where is Qmake on Mac?

Qmake is at /usr/local/opt/qt/bin .

What is Qmake command?

qmake is a utility that automates the generation of makefiles. Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or makemake for short.

Does Qt work on Mac?

Instead, macOS uses its own native windowing system that is accessible through the Cocoa API. To download and install Qt for macOS, follow the instructions on the Getting Started with Qt page. To build Qt from source, see Qt for macOS - Building from Source.


1 Answers

Did you set the environment variable PATH with the path to Qt?

in Terminal do: echo $PATH and look for something like /usr/local/Qt-5.x.x/bin:PATH

If there is not any path to your installed qt, set it like this:

In .profile (if your shell is bash), add the following lines:

PATH=/usr/local/Qt-5.0.2/bin:$PATH
export PATH

To help you in the process you probably would like to read here: QT mac install

ANSWER TO NEW QUESTION

If writing code nothing seems to be recognized you should add the link to your include directory. The include directory is where there are all the header file, so your IDE can give you suggestion about class method etc...

like image 134
andrea.marangoni Avatar answered Oct 10 '22 17:10

andrea.marangoni