The sections below show you how to create a simple project using Eclipse*.
Create a New Eclipse Project
To create a new Eclipse project:
- Select
File > New > Project... The
New Project wizard opens.
- Expand the
C/C++ Project tab and select the appropriate project type. Click
Next to continue.
- For
Project name, enter
hello_world. Deselect the
Use default location to specify a directory for the new project.
- In the
Project Type list, expand the
Executable project type and select
Hello World C++ Project
- In the
Toolchains list, select
Intel C++ Compiler Classic. Click
Next.
Note
- If you need to see the toolchains for the compilers that are not locally installed, uncheck
Show project types and toolchains only if they are supported on the platform. You are only able to view and configure these toolchains if the proper compilers are installed.
- If you have multiple versions of the compiler installed, they appear in the project’s properties under
C/C++ Build > Settings on the
Intel® C++ Compiler Classic tab.
- The
Basic Settings page allows specifying template information, including
Author and
Copyright notice, which appear as a comment at the top of the generated source file. After entering desired fields, click
Next.
- The
Select Configurations page allows specifying deployment platforms and configurations. By default, a
Debug and
Release configuration is created for the selected toolchain. Select no (Deselect all), multiple, or all (Select all) configurations. To edit project properties, click the
Advanced settings button. Click
Finish to create the
hello_world project.
Note
Configurations can be created after the project is created by selecting
Project > Properties.
- If the view is not the
C/C++ Development Perspective (default), an
Open Associated Perspective dialog box opens. In the
C/C++ Perspective, click
Yes to proceed.
An entry for your
hello_world project appears in the
Project Explorer view.
Add a C Source File
To add a source file to the
hello_world project:
- Select the
hello_world project in the
Project Explorer
view.
- Select
File
> New
> Source File. The
New Source File
dialog box opens.
Note
The dialog box automatically populates the source folder for the source file to be created. You can change this by entering a new location or selecting
Browse.
- Enter
new_source_file.c in the
Source File
field.
- Select a
Template
from the drop-down list or
Configure
a new template.
- Click
Finish
to add the file to the
hello_world
project.
- In the
Editor
view, add your code for
new_source_file.c.
- When your code is complete,
Save
your file.
Set Options for a Project or File
You can specify compiler, linker, and archiver options at the project and source file level. Follow these steps to set options for a project or file:
- Right-click a project or source file in the
Project Explorer.
- Select
Properties. The property pages dialog box opens.
- Select
C/C++ Build >
Settings.
- Select the
Tool Settings tab and click an option category for
Intel C Compiler,
Intel C++ Compiler, or
Intel C++ Linker for a C++ project, or select
Intel® oneAPI DPC++ Compiler or
Intel® oneAPI DPC++ Linker for a DPC+++ project.
- Set the options to apply to the project or file.
Note
- Some properties use check boxes, drop-down boxes, or dialog boxes to specify compiler options. For a description on options properties, hover over the option to display a tooltip. After setting the desired options in command line syntax, select
Apply.
- To specify an option that is not available from the
Properties dialog, use
C/C++ Build Settings >
Settings >
<Compiler> >
Command Line. The Compiler entry has one of the following values: or Intel® oneAPI DPC++ Compiler. Enter the command line options in the
Additional Options field using command-line syntax and select
Apply.
- You can specify option settings for one or more configurations by using the
Configuration drop-down menu.
- Click
Apply and Close.
The compiler applies the selected options, using the selected configurations, when building. To restore default settings to all properties for the selected configuration, click the
Restore Defaults button on any property page.
Exclude Source Files from a Build
To exclude a source file from a build:
- Right-click a file or folder in the
Project Explorer.
- Select
Resource Configurations >
Exclude from build. The
Exclude from build dialog box opens.
- Select one or more build configurations to exclude the file or folder from.
- Click
OK.
The compiler excludes that file or folder when it builds using the selected project configuration.
Build a Project
To build your project:
- Select the
hello_world project in the
Project Explorer
view.
- Select
Project
> Build Project.
See the
Build
results in the
Console
view.
For a C/C++ project, use:
**** Build of configuration Debug for project hello_world ****
make all
Building file: ../src/hello_world.cpp
Invoking: Intel® C++ Compiler Classic
icpc -g -O0 -MMD -MP -MF"src/hello_world.d" -MT"src/hello_world.d" -c -o "src/hello_world.o" "../src/hello_world.cpp"
Finished building: ../src/hello_world.cpp
Building target: hello_world
Invoking: Intel C++ Linker
icpc -O0 -o "hello_world" ./src/hello_world.o
Finished building target: hello_world
Build Finished. 0 errors, 0 warnings.
Detailed descriptions of errors, warnings, and other output can be viewed by selecting the
Problems
tab.
Run a Project
After building a project, you can run your project by following these steps:
- Select the
hello_world project in the
Project Explorer view.
Select
Run As > Local C/C++ Application.
When the executable runs, the output appears in the
Console view.
Error Parser
The Error Parser (selected by default) lets you track compile-time errors in Eclipse. To confirm that the Error Parser is active:
- Select the
hello_world project in the
Project Explorer view.
- Select
Project > Properties.
- In the
Properties dialog box, select
C/C++ Build > Settings.
- Click the
Error Parsers tab. Make sure that
Intel C++ Error Parser is checked, and
CDT Visual C Error Parser or
Microsoft Visual C Error Parser are not checked.
- Click
OK to update your choices, if you have changed any settings.
Use the Error Parser
The Error Parser automatically detects and manages the diagnostics generated by the
Intel® C++ Compiler Classic.
If an error occurring in the
hello_world.c program is compiled, for example,
#include <xstdio.h>, the error is reported in the
Problems view next to an error marker.
You can double-click on each error in the
Problems view to highlight the source line, which causes the error in the
Editor view.
Correct the error, then rebuild your project.