ubuntu下QT无法编译的问题

blueboy82006 2010-02-08 11:30:59
我按照如下方法在ubuntu上安装的QT

sudo apt-get install qt4-dev-tools
sudo apt-get install qtcreator
但问题很大,
写个最简单的控制台程序hello world都无法编译,
事实文明无论什么程序都无法build也无法run
我用QT自带的example试了一下,一个也运行不起来。。。

请问是什么地方的问题?高手指点。。。
...全文
787 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
blueboy82006 2010-02-10
  • 打赏
  • 举报
回复
引用 22 楼 aoxuehan0424 的回复:
应该是在/home/你的用户名/qtsdk4.6.1 这里吧。

没有啊。。。是不是这个啊 /usr/share/qt4/bin
里面有7个文件:qmake,designer,lrelease,moc,rcc,uic,lupdate
aoxuehan0424 2010-02-10
  • 打赏
  • 举报
回复
应该是在/home/你的用户名/qtsdk4.6.1 这里吧。
blueboy82006 2010-02-10
  • 打赏
  • 举报
回复
写了个helloworld总算运行起来了。。。多谢楼上各位了。。。
MicroSky2813 2010-02-10
  • 打赏
  • 举报
回复
引用 23 楼 blueboy82006 的回复:
引用 22 楼 aoxuehan0424 的回复:应该是在/home/你的用户名/qtsdk4.6.1 这里吧。
没有啊。。。是不是这个啊 /usr/share/qt4/bin
里面有7个文件:qmake,designer,lrelease,moc,rcc,uic,lupdate


如果没有qt4/qt/bin的话就是qt4/bin了
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
我总结一下我到步骤:
sudo apt-get install build-essential
安装G++

然后从qt网站下载linux到完整开发包.bin 文件
在linux下双击,然后会安装,安装好之后,设置环境变量(方法网上有)。
OK

然后下面到操作都没有问题了!
qmake -project
qmake **.pro
make
MicroSky2813 2010-02-09
  • 打赏
  • 举报
回复
直接下个集成SDK
http://qt.nokia.com/downloads

http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp

这些就都做好了
blueboy82006 2010-02-09
  • 打赏
  • 举报
回复
引用 18 楼 aoxuehan0424 的回复:
顺便告诉你怎么设置环境变量。就不用去查了:

sudo gedit /etc/profile
在最后添加两行:
PATH="$PATH:qt安装目录/qt/bin"
export PATH
重启或注销就好了

我就直接默认安装的
sudo apt-get install qt4-dev-tools
sudo apt-get install qtcreator
QT路径怎么找好像装了好多东西,哪个是,usr里吗?弱弱地问一下。。。
blueboy82006 2010-02-09
  • 打赏
  • 举报
回复
多谢楼上各位,我先去试试,有问题再回来请教。。。
pornographer 2010-02-09
  • 打赏
  • 举报
回复
环境变量设了么

另外最好用官网的下来编译
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
查看设置成功没 用:
echo $PATH(大写)
上面我说的设置方法 PATH也要大写
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
顺便告诉你怎么设置环境变量。就不用去查了:

sudo gedit /etc/profile
在最后添加两行:
PATH="$PATH:qt安装目录/qt/bin"
export PATH
重启或注销就好了
MicroSky2813 2010-02-09
  • 打赏
  • 举报
回复
环境变量设在qt/bin,这个文件夹里有qmake,和一堆Qt的东西
Eugen_Rommel 2010-02-09
  • 打赏
  • 举报
回复
QT 里面要设置下 要加QMAKE
14楼是对的
我之前用的是Ubuntu 8.1 安装了SDK 后 改了Qmake 就能编译了
dyw 2010-02-09
  • 打赏
  • 举报
回复
sudo apt-get install build-essential
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
引用 11 楼 blueboy82006 的回复:
qmake后什么没有代表什么?


什么没有?
那就说明你没有设置环境变量。

我的qmake 之后:

Usage: qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *.c; *.ui; *.y; *.l; *.ts; *.xlf; *.qrc; *.h; *.hpp; *.hh; *.hxx; *.H; *.cpp; *.cc; *.cxx; *.C
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directory

Warnings Options:
-Wnone Turn off all warnings
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings

Options:
* You can place any variable assignment in options and it will be *
* processed as if it was in [files]. These assignments will be parsed *
* before [files]. *
-o file Write output to file
-unix Run in unix mode
-win32 Run in win32 mode
-macx Run in Mac OS X mode
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-after All variable assignments after this will be
parsed after [files]
-norecursive Don't do a recursive search
-recursive Do a recursive search
-set <prop> <value> Set persistent property
-query <prop> Query persistent property. Show all if <prop> is empty.
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [project mode only]
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
引用 13 楼 microsky2813 的回复:
引用 6 楼 aoxuehan0424 的回复:
我总结一下我到步骤:
sudo apt-get install build-essential
安装G++

然后从qt网站下载linux到完整开发包.bin 文件
在linux下双击,然后会安装,安装好之后,设置环境变量(方法网上有)。
OK

然后下面到操作都没有问题了!
qmake -project
qmake **.pro
make

那你就应该打好开发环境了,写个Helloworld试试


我前几天装到ubuntu之后就装了qt
我都写了几个程序了。。。。
就是qmake -project
qmake **.pro
make 这样弄的。
要设置环境变量。
MicroSky2813 2010-02-09
  • 打赏
  • 举报
回复
引用 6 楼 aoxuehan0424 的回复:
我总结一下我到步骤:
sudo apt-get install build-essential
安装G++

然后从qt网站下载linux到完整开发包.bin 文件
在linux下双击,然后会安装,安装好之后,设置环境变量(方法网上有)。
OK

然后下面到操作都没有问题了!
qmake -project
qmake **.pro
make 


那你就应该打好开发环境了,写个Helloworld试试
MicroSky2813 2010-02-09
  • 打赏
  • 举报
回复
QT自带的example你找里面有release文件的例子再编译,
你不是按照字母顺序先去编译AXTIVE了吧
blueboy82006 2010-02-09
  • 打赏
  • 举报
回复
qmake后什么没有代表什么?
aoxuehan0424 2010-02-09
  • 打赏
  • 举报
回复
忘记说了。
你在终端里面输入qmake
看看有没有显示参数说明?
加载更多回复(5)

16,211

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧