–Administration of the SDKs
–Automatic generation of required metadata and configurations
–Automatic creation of the completed library
–Extensive toolchain based on a console
You can use the freely available Eclipse® software with the
The use of the Eclipse® add-in requires the installation of
•Before starting the installation, ensure that the system requirements are met.
•Download the necessary software.
–Microsoft® Windows® 10
–Linux (Ubuntu 18.04.1.LTS)
Phoenix Contact software
The CLI is a command line interface. It can be used, e.g., for generating metadata, C++ header files,
An SDK contains all of the important toolchains and libraries required for creating a program. The SDK is installed via the CLI (see Section 6.1.3).
Some sample applications programmed in C++ can be found at.
Installing in Windows
•Run the installation file.
•Follow the instructions of the installation wizard.
Installing in Linux
The following packages are required for installation in Linux:
Required for SDK installation.
Required for SDK installation.
The package contains the major part of the toolchain required for C++ programming, e.g., “make”.
The “EngineeringLibraryBuilder” requires this library.
Is used by the debug script.
To check if the packages were installed or are being installed, enter the following command:
sudo apt-get install xz-utils python3 build-essential libunwind8
•Then, run the “PLCnCLI_Setup.sh” file.
•Read and accept the “Software License Terms”.
You will then receive a folder named “plcncli” to which the
•For this, enter the following command:
ln -s [Path to the PLCnCLI installation folder]/plcncli /usr/
E.g.: ln -s /home/plcncli/plcncli /usr/local/bin/plcncli
•Download the SDK that is suitable for your controller from the download area of your controller at .
•Unpack the .zip file.
•Call the CLI in the console using the following command:
plcncli.exe install sdk –d [Installation path] –p [Path to archive file]
E.g.: plcncli.exe install sdk -d C:\CLI\SDKs\AXCF2152\2019_0\ -p C:\CLI\pxc-glibc-x86_64-axcf2152-image-mingw-cortexa9t2hf-neon-
If you install several SDKs,
Introducing an SDK
•To introduce already unpacked SDKs to the CLI, enter the following command:
plcncli.exe set setting –a SdkPaths [Path to SDK]
E.g.: plcncli.exe set setting –a SdkPaths C:\CLI\SDKs\AXCF2152\2019_0\
•To receive a list of all available settings and the set values, enter the following command:
plcncli.exe get setting –a
Uninstalling an SDK
–To uninstall an SDK, enter the following command:
plcncli.exe set setting –r [Path to SDK]
The uninstalled SDK is removed from the
You can execute many functions directly using the Command Line Interface (CLI). The CLI provides the following features, which you can call by means of simple commands:
–Generating metafiles (*.progmeta, *.compmeta, *.libmeta)
–Generating C++ frames and header files
–Compiling with CMake
CLI command structure
Use the Command Line Interface to call functions by means of simple commands.
•Activate the CLI by calling the plcncli.exe via the shell, e.g., C:\CLI\plcncli.exe.
There is a long and a short form for the commands, which you can use as you like:
•To add the parameters, prefix “--”.
E.g.: new project --name MyProject1
•To add the parameters, prefix “-”.
E.g.: new project -n MyProject1
The functions are structured hierarchically. For each command, there is another level of commands that specifies the desired function in more detail. Use the --help command to call a description of the individual functions.
E.g.: new project --help
Figure 6-1 Description of functions
If you do not specify all the parameters, the system will use default parameters. The values will be displayed after the command was executed.
If you do not specify a directory path via the --path option, e.g., when creating a project, a subfolder is created and used in the current directory.
CLI command overview
E.g., C:\CLI\plcncli.exe new...:
Compile a project
Generate libraries, metafiles and code files
Query information about projects, controllers, etc.
Make settings, e.g., select a controller
Update of controllers in the current project
Create new files/projects
Call additional information about a specific command
Show version information
Each command can be specified using additional parameters. Commands consist of the following:
-n or --name
If you require information on parameters or additional command levels, you can request them for each level by means of the --help command.
Configuring a project
The following example shows an option of how to configure a project up to the complete PLCnext library using the
•Open a project folder of your choice:
e.g., C:\Users\<username>\Documents\CLI Projects.
•Generate a new project with the project name “Project1”:
\CLI\Plcncli.exe new project –n Project1
•Go to the “Project1” project folder:
•Select the desired controller for the project (e.g., AXC F 2152):
plcncli.exe set targets --add -n AXCF2152
•Use the following command to generate the necessary metafiles for the project:
\CLI\plcncli.exe generate config
•Use the following command to generate the necessary code files for the project:
\CLI\plcncli.exe generate code
•You can also generate metafiles and code files in only one step:
\CLI\plcncli.exe generate all
•Compile the project.:
•Generate a library:
\CLI\plcncli.exe generate library
⇒The library and the .so files are located in the “bin” folder of the project.
For additional information on programming the code, please refer to Section 5, “Structure of a C++ program”.
Importing the library
You can then import the generated library in
The Eclipse® add-in for PLCnext C++ programming enables you to use the
•Download the Eclipse® CDT Photon (9.5.2) software with the “Eclipse IDE for C/C++ Developers” package from .
•Copy and unpack the files to any folder.
•You can execute Eclipse® right away.
The Java™ Runtime Environment is required for the Eclipse® development environment.
If an error with “error code 13” occurs when Java is started, check if the correct Java version is installed. If you use a 64-bit Eclipse version, you have to use a 64-bit Java version.
•Install the PLCnext Command Line Interface according to the information in Section 6.1.2, “Installing PLCnCLI”.
•Install the SDKs according to the information in Section 6.1.3, “Installing SDKs”.
•If necessary, uninstall earlier add-in versions (see Uninstalling the add-in).
•Open the “Help, Install New Software...” menu.
Figure 6-2 “Help, Install New Software...” menu
•To select the path to the directory of the add-in, click on “Add” in the “Install” dialog (see Figure 6-3).
•In the “Add Repository” dialog, click on “Archive” and select the archive of the add-in.
You will find it in the installation folder of the
•Enter a name of your choice in the “Name” input field and confirm with “Add”.
•Disable the “Contact all update sites during install to find required software” check box.
•Click on the “Next” button.
•Read and accept the licence agreements.
•Click “Finish” to complete the installation.
Updating the add-in
•To update the Eclipse® add-in, proceed as described in Section Installing the add-in.
•Open the “Help, About Eclipse IDE” menu.
•Click on the “Installation Details” button.
Figure 6-4 “Help, About Eclipse IDE” menu
•Select the earlier add-in versions and uninstall them.
This section describes how to create a new C++ project in Eclipse®.
•Open the “File, New, Project...” menu.
Figure 6-5 Creating a new project
The “New Project” window opens (see Figure 6-6).
•Select the “PLCnext C++ Project” wizard from the selection list.
•Confirm your selection with “Next”.
•Enter a project name in the “Project name” input field.
•In the “Toolchains” area, select the “PLCnext C++ Toolchain” entry.
•Confirm with “Next”.
Figure 6-7 Selecting toolchains
•Enter a name for the program and component in the corresponding input fields.
Figure 6-8 Entering a name for the program and component
•Select the desired controller and firmware status for the project.
Figure 6-9 Selecting the controller and firmware status
You can also change the selection of the desired controller and the corresponding firmware status after the project has been created.
•Open the “Project, Properties” menu.
•Select the “PLCnext Targets” option.
•Remove controllers or add new controllers and their firmware version.
•Click the “Finish” button.
You can not start creating the program.
To create a C++ program using Eclipse®, which can be imported as a library into
The created project has a defined structure in which the C++ program is created. Figure 6-10 shows an example.
To create a program, proceed as follows:
•Open the *.cpp source file.
•Program the code to be executed during each ESM task cycle in the “Execute()” function (see comment //TODO implement program).
For additional information on programming in C++, please refer to Structure of a C++ program.
After instantiation of a program, the assigned ESM task calls the Execute() function of the program instance in each cycle.
Example projects and the associated documentation can be downloaded at.
Recommended: Make the following setting so that your files are saved automatically before you execute the “Build Project” option:
•In Eclipse®, open the “Window, Preferences” menu.
•Select “General, Workspace, Build”.
•Enable the “Save automatically before build” check box.
•Make this setting separately for each workspace.
•Switch to the “Project Explorer” to compile the project.
•Right-click to open the context menu for the project folder
(in the example: “FirstProject1”).
•In the context menu, click on the “Build Project” option or click on the button in the tool bar.
Figure 6-11 “Build Project”
Successful compilation of the project or possible error messages are displayed on the “Console” tab.
Figure 6-12 Example: “Console”
Note regarding compiler warning
For each defined port, you receive the compiler warning:
E.g.: [cmake]: /home/user/Workspace/Counters/intermediate/code/Counters
You can ignore this warning in conjunction with your defined ports or suppress it using the -Wno-invalid-offsetof CMake parameter.
If compilation was successful, a shared object (*.so) is generated.
To be able to use the program in
A description on how to set up a remote debugging session for a running process is available in the.