Ubuntu install Eclipse for C + +

Source: Internet
Author: User
Tags gtk

The GUI of Linux is inferior to WinDOS, although its terminal mode (command line mode) is very powerful. The Linux distribution Ubuntu GUI is a little more ornate than other versions, so the recent shift from Redhat to Ubuntu for Linux learning. Once I used the GCC command-line mode to compile and debug the C program, but I still want to be able to give me a better visual experience and convenient operation to avoid the cumbersome operation of the command line, so I try to install an Eclipse integrated development environment on my Ubuntu.

About Eclipse

Eclipse is an open-source, Java-based, extensible development platform. For its part, it is just a framework and a set of services for building a development environment through plug-in components. Fortunately, Eclipse comes with a standard set of plugins, including Java development tools (Java Development kit,jdk).

While most users are happy to use eclipse as the Java Integrated development Environment (IDE), Eclipse's goal is not limited to this. Eclipse also includes the plug-in development environment (plug-in development Environment,pde), which is intended for software developers who want to extend eclipse because it allows them to build tools that integrate seamlessly with the eclipse environment. Since everything in Eclipse is a plug-in, all tool developers have the same place for providing plug-ins for Eclipse and for providing users with a consistent and unified environment for integrated development.

This equality and consistency is not limited to Java development tools. Although Eclipse was developed in the Java language, it is not intended to be used in the Java language, for example, plugins that support programming languages such as C + +, COBOL, and PHP are already available, or are expected to be rolled out. The Eclipse framework can also be used as a basis for other types of applications unrelated to software development, such as content management systems.

recommended for users who need only C/D + + development features

It is also possible to install eclipse via Ubuntu's own installation tool, which executes the command #apt-get install eclipse. However, after this installation, it will not support C/D + + development, you will also need to install the CDT plugin, execute the command #apt-get install ECLIPSE-CDT. This installation is simple, but there may be many problems during installation. In addition, this installation will install additional plugins unrelated to C + + development (such as the Java Development plugin), which will waste our disk space. With these considerations in mind, it is recommended that you download the source package for the Eclipse IDE for C + + developers and then install and configure it yourself, which is reliable and does not install unnecessary plugins.

Installation of Eclipse IDE for C + + developers under Ubuntu

First, install the JDK

Eclipse is a Java application developed in the Java language, which means that eclipse can only run on a Java virtual machine. If you do not have the JDK installed (Java development Kit), even if Eclipse is installed on Ubuntu, you will not be able to run it, so install the JDK by executing the following command first.

#apt-get Install Openjdk-6-jre-headless

Second, get the eclipse IDE for C + + developers source Package

Download the Eclipse IDE for C + + developers from http://www.eclipse.org/downloads/?osType=linux&release=undefined, File eclipse-cpp-kepler-sr1-linux-gtk.tar.gz. It is important to note that the version that is downloaded is Linux, and note the number of bits in the CPU.

Three, decompression installation

#tar XZVF eclipse-cpp-kepler-sr1-linux-gtk.tar.gz-c/opt

Unzip the installation package into the/OPT directory, and the default is to create an Eclipse directory in that directory. From the Eclipse directory, you can see an eclipse executable program that you can try to run with the following command.

$CD/opt/eclipse

$./eclipse

Iv. Setting Environment variables

Eclipse IDE for C + + developers has been successfully installed, but terminal mode must be in this directory to run the program. To allow the program to run under any directory (like the CD command), do the following.

#vi/etc/profile

Add a sentence on the last side of the profile file: Export path= $PATH:/opt/eclipse; save, exit

#source/etc/profile

Try running the following command to start the Eclipse application.

#eclipse

Explanation: Since the Eclipse installation package was extracted to/opt/eclipse, the executable program eclipse is in this directory, but this directory is not the default directory for the system search application. This is done by adding export path= to the System environment variable file $PATH:/opt/eclipse A directory of the search application, so that you can enter the command directly $eclipse the terminal to open the software.

New problem: Eclipse is opened when the endpoint enters Eclipse. However, other operations cannot be performed under the terminal, and eclipse must be turned off before the command can be re-entered on the terminal.

Solve the problem of "no other operation at the terminal after the terminal input Eclipse"

One way to do this is to add a "&" symbol when you enter the command, which is the #eclipse& of the command, which solves the problem. Although more than one symbol is not a big deal, but not in line with our habits, can be configured as follows to achieve the desired effect.

#vi/etc/profile

Add a sentence on the last side of the profile file: Alias eclipse= ' eclipse& '; save, exit

#source/etc/profile

After this operation, the Eclipse software starts in the background after the terminal enters #eclipse, and does not affect the terminal's continued use.

Vi. add Eclipse application icon on Ubuntu desktop

Although it is possible to run eclipse through a terminal, it is more convenient to use eclipse if you can double-click the application directly on the desktop like Windows, and the application will open automatically, with the following actions.

1. Use VI to create a file named "Eclipse.desktop" in the user-to-desktop directory and add the following:

[Desktop Entry]
Name=eclipse
Comment=eclipse IDE
Exec=/opt/eclipse/eclipse Note: Setting the application location
ICON=/OPT/ECLIPSE/ICON.XPM Notes: Setting icons
Terminal=false
Type=application
Categories=application;development;
 
 

2. Then give the file the right to run the "#chmod 777 eclipse.desktop" command

Add: If it is installed with the Deb package, you can copy the/usr/share/applications/under the Eclipse.desktop file to the desktop directory.

With these two steps, you can see the Eclipse icon on your desktop, and you can run the program by double-clicking it.

Ubuntu install Eclipse for C + +

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.