This cheat sheet will guide you through the process of creating and
building a "Hello World ANSI C Autotools Project" or
a "Hello World C++ Autotools Project"
application that uses a Yocto Project template.
-
Select Window > Open Perspective >
Other... from the menu bar.
Choose C/C++ from the Open Perspective dialog.
Click OK.
-
You need to specify a toolchain and sysroot location before
building any project in the workspace.
The global settings can be modified in the Yocto Project ADT
section of the eclipse preferences. Select Window >
Preferences from the menu bar and then select the section
Yocto Project ADT. These settings are the default ones for
every project you create in the workspace.
Choose in the Cross Compiler Options the
Standalone pre-built toolchain.
Provide a Toolchain Root Location (e.g.
/opt/poky/1.3 or some other location on the filesystem).
Provide a Sysroot Location. This is the filesystem
containing libraries, headers etc. used while cross-building
binaries for the target.
If more than one toolchain is found in the Toolchain
Root Location, use the drop-down box to select the Target
Architecture. Make sure that the selected sysroot matches
the toolchain.
Choose in the Target Options whether the target is a QEMU
emulation (kernel location required) or an external hardware.
The target is used for running or remote debugging the binaries
created for it.
Save the settings with Apply and OK. You can later
change these settings for any project from the menu
Project > Change Yocto Project Settings.
-
Choose between the available "Hello World ANSI C Autotools
Project" or the "Hello World C++ Autotools Project"
template projects.
You selected ${progLanguage}.
-
Create a Yocto Project ADT Project "Hello World ANSI C Autotools
Project" or "Hello World C++ Autotools Project"
by using the appropriate Project wizard.
Click File > New > C++ Project to
launch the C++ Project wizard.
Click File > New > C Project to
launch the C Project wizard.
Enter HelloWorld as the project name, then select
Yocto Project ADT Project >
Hello World C++ Autotools Project from the Project type
list and click Next.
Enter HelloWorld as the project name, then select
Yocto Project ADT Project >
Hello World ANSI C Autotools Project from the Project type
list and click Next.
Fill in the name of the Author. Make some changes in the
other fields if needed. Possibly change the License from
the drop-down box and click Next.
If needed make some Advanced settings. Confirm them with
Apply and OK.
Click Finish to create the project in your workspace. You
will find the created project in the Project Explorer view.
-
Create the project's binary using a specified toolchain and
sysroot.
Make sure that the project is on focus in the
Project Explorer view.
If you want to change the default settings for toolchain and
sysroot location go to Project >
Change Yocto Project Settings in the menu bar. Finish the
editing by pressing OK.
If you have changed the settings in the previous step, call
Project > Reconfigure Project to reconfigure the
project with these new settings (e.g. create the correct Makefiles
that make use of the selected toolchain and sysroot).
Build the project with a click on the hammer symbol in the
Toolbar. Alternatively, go to Project >
Build Project. If you didn't change the default
toolchain and sysroot, now the configuring step will be executed
at first, followed by the build step itself.
Observe the output in the different consoles (e.g.
Configure [HelloWorld] and
CDT Build Console [HelloWorld]) to check if everything
was successful.
Congratulations, you have completed this cheat sheet! You may
continue with editing, rebuilding or debugging the
Hello World Autotools Project.