无法在Mac终端中运行qmake [英] Cannot run qmake in Mac Terminal

查看:1219
本文介绍了无法在Mac终端中运行qmake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Qt在我的大学的C ++课程。我试图为我的第一个任务设置环境,但我似乎不能得到它的权利。我发誓我已经运行qmake在终端前,但现在,因为我安装Qt 5.2与Qt Creator我无法在终端中创建项目。



如果我尝试使用

  #include< QtGui>来编译标准C ++文件, 

编译器将找不到它。我使用的g ++编译器将找不到我尝试导入的任何Qt库。我看上去在线,我发现的解决方案只是运行

  brew install qt 

在终端,并希望它排序自己,虽然终端引发错误,将不会安装它下载后。我真的需要让这项工作为我的任务。



任何帮助将非常感谢。
提前感谢!



* EDIT *



我添加了qmake bin到我的PATH变量。这是路径:

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



问题是,现在没有什么在我的C ++源文件被识别。

解决方案

是否设置了环境变量

code> echo $ PATH

c $ c>并查找 /usr/local/Qt-5.xx/bin:PATH



如果没有任何路径到您安装的qt,设置如下:



在.profile(如果你的shell是bash),添加以下行: p>

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

为了帮助您在这个过程中,你可能想在这里阅读: QT mac安装



回答新问题



如果写入代码似乎无法识别,您应该将链接添加到您的 include 目录。 include 目录中有所有的头文件,所以你的IDE可以给你建议类方法等...


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?

解决方案

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

这篇关于无法在Mac终端中运行qmake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆