2.2. Using Eclipse

To start the Red Hat Developer Toolset version of Eclipse, either select ApplicationsProgrammingDTS Eclipse from the panel, or type the following at a shell prompt:
scl enable devtoolset-4 'eclipse'
During its startup, Eclipse prompts you to select a workspace, that is, a directory in which you want to store your projects. You can either use ~/workspace/, which is the default option, or click the Browse button to browse your file system and select a custom directory. Additionally, you can select the Use this as the default and do not ask again check box to prevent Eclipse from displaying this dialog box the next time you run this development environment. When you are done, click the OK button to confirm the selection and proceed with the startup.

2.2.1. Using the Red Hat Developer Toolset Toolchain

To use the Red Hat Developer Toolset version of Eclipse with support for the GNU Compiler Collection and binutils from Red Hat Developer Toolset, make sure that the devtoolset-4-toolchain package is installed and run the application as described in Section 2.2, “Using Eclipse”. Red Hat Developer Toolset Eclipse uses the Red Hat Developer Toolset toolchain by default.
For detailed instructions on how to install the devtoolset-4-toolchain package in your system, see Section 1.5, “Installing Red Hat Developer Toolset”.

Important

If you are working on a project that you previously built with the Red Hat Enterprise Linux version of the GNU Compiler Collection, make sure that you discard all previous build results. To do so, open the project in Eclipse and select ProjectClean from the menu.

2.2.2. Using the Red Hat Enterprise Linux Toolchain

To use the Red Hat Developer Toolset version of Eclipse with support for the toolchain distributed with Red Hat Enterprise Linux, change the configuration of the project to use absolute paths to the Red Hat Enterprise Linux system versions of gcc, g++, and as.
To configure Eclipse to explicitly use the Red Hat Enterprise Linux system versions of the tools for the current project, complete the following steps:
  1. In the C/C++ perspective, choose ProjectProperties from the main menu bar to open the project properties.
  2. In the menu on the left-hand side of the dialog box, click C/C++ BuildSettings.
  3. Select the Tool Settings tab.
  4. If you are working on a C project:
    1. select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:
      /usr/bin/gcc
    2. select GCC C Linker or Cross GCC Linker and change the value of the Command field to:
      /usr/bin/gcc
    3. select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:
      /usr/bin/as
    If you are working on a C++ project:
    1. select GCC C++ Compiler or Cross G++ Compiler and change the value of the Command field to:
      /usr/bin/g++
    2. select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:
      /usr/bin/gcc
    3. select GCC C++ Linker or Cross G++ Linker and change the value of the Command field to:
      /usr/bin/g++
    4. select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:
      /usr/bin/as
  5. Click the OK button to save the configuration changes.