安装JDK
1,去官网下了一个.bin的包,然后直接命令行下./xx.bin运行,发现在同目录中多了jdk的文件夹。
2,配置环境,修改了bash.bashrc,加上了:
export JAVA_HOME=/usr/local/bin/.../jdk刚生成的文件夹路径
export PATH=$JAVA_HOME/bin:$PATH
注意:一定不要忘了后面那个:$PATH,我就是给忘了,结果系统都登录不上去了,只能从命令行模式进去重新修改了。
然后按照同样的方法,把以上两句添加到/etc/profile和/etc/environment两个文件中。
安装eclipse。
1,去官网下了一个eclipse for c/c++的压缩文件,然后放到/opt目录中,然后用命令行解压。如果之前JDK安装成功的话,解压后到目录中直接运行./eclipse就能启动了。
安装QT
1,我去官网下了一个源码包,还要自己配置自己编译,废了好长时间,不知能不能有更快的方法,应该找找apt-get什么的。
2,把源码包放在任意位置,命令行解压,按照官网的安装要求,逐步安装就可以了。先./configure,如果报错的话,需要安装几个库,类似apt-get install libX11-dev 什么的。
3,make. 如果出错,按照上面的办法下载几个库。
4,make install.
安装Qt Eclipse Integration for C++
1,去官网下了一个Qt Eclipse Integration for C++ 的linux版本。
2,安装或卸载它,依照如下内容:
Installation Instructions for Linux Systems
1. Install Eclipse 3.3.2 or higher
2. Install Eclipse C/C++ CDT Plugin 4.0 or higher
3. Download the Qt Eclipse Integration package corresponding to your
Linux distribution
4. Find your eclipse/plugins folder
If you installed Eclipse to e.g. /usr/local in step (1.), you will
find the directory /usr/local/eclipse/plugins there.
If you used the package management system of your Linux distribution
to install Eclipse, this directory might possibly be
/usr/lib/eclipse/plugins.
5. Unpack the package
Go to the location where you found the eclipse/plugins directory
(i.e. /usr/local or /usr/lib in the examples in step (4.) ) and
untar the package, e.g.
cd /usr/local
tar xzf ~/Downloads/qt-eclipse-integration-linux.x86-<version>.tar.gz
You might need to be the root user to do that.
6. Start Eclipse with a clean configuration
It is highly recommended by us to start Eclipse once from the
command line with
eclipse -clean
after you unpacked the Qt Eclipse Integration plugins and feature.
This will not change anything in your workspace but will clear
Eclipse's caches.
Uninstallation Instructions for Linux Systems
1. Remove the installed plugins and feature
Go to the location where you installed the Qt Eclipse Integration
package, e.g. /usr/local/eclipse or /usr/lib/eclipse, and remove all
files/directories in plugins/ and features/ that start with
com.trolltech.qtcpp
cd /usr/local/eclipse
rm -r plugins/com.trolltech.qtcpp*
rm -r features/com.trolltech.qtcpp*
2. Restart Eclipse with a clean configuration
It is highly recommended by us to start Eclipse once from the
command line with
eclipse -clean
after you removed the Qt Eclipse Integration plugins and feature.
This will not change anything in your workspace but will clear
Eclipse's caches.
Upgrading Instructions for Linux Systems
If you want to upgrade your Qt Eclipse Integration installation we
highly recommend to first uninstall the older version:
1. Remove the older installed plugins and feature
Like described in step (1.) of the 'Uninstallation Instructions'.
2. Install the newer Qt Eclipse Integration
Like described in 'Installation Instructions'.
3. Restart Eclipse with a clean configuration
Like described in step (2.) of the 'Uninstallation Instructions'.
最后一步!!!
1,安装好了以后,我们配置一下eclipse!!
There may be some messages in the terminal when opening eclipse, don’t worry that’s normal. There will probably be an initial welcome screen. You can choose just to go to the bench/workspace. You may be prompted for a default workspace location. Change it or leave it, the choice is yours. Now go to File > New > Project… and then a wizard pops up. Scroll down and choose Qt folder then QT Gui Project. Click next.
Then input any “Project Name”, I choose test. Click Next. Then in the next window leave defaults and click Next. Finally the Last window leave defaults and click Finish. You will then get an Error window popup which says no default QT version is set. So click the “Open preferences button”.
Now click add and then enter the settings as per the picture below.
Then click Finish and then Ok. You will be prompted that the QT version has changed and a rebuild of the project is necessary. Click Yes. It may also prompt you that this kind of project is associated with the C/C++ view, you can also accept this as it just changes the workspace layout within eclipse.
There the project should rebuild in the background but you are done!
Now you can create QT gui or console projects, and you can even edit the qt4.ui files within eclipse using the qt4-designer (part of the qt eclipse-cdt plugin). And to compile/run a project you just go to the Project > Run.