Required Installations for C++ and C# programming

Valid from toolchain 2021.6 - for former releases see Required Installations

In order to develop C++ programs and use them in a real-time application, the following installations are required. 

System requirements

Before starting the installation, ensure that the system requirements are met: 

Operating system

  • The PLCnext CLI was tested and released for Microsoft®  Windows® 10 and for Linux® (tested with Ubuntu 18.04.1.LTS) 

Phoenix Contact software

  • PLCnext CLI:
    The PLCnext CLI is a command line interface that can be used for generating metadata, C++ header files, PLCnext Engineer libraries and for the build process. The functions can be called using simple commands. An integrated help lists the commands and describes their functions.
  • PLCnext Technology SDK:
    An SDK contains all of the important toolchains and libraries required for creating a program. The SDK can be installed via the PLCnext CLI (see steps below), or by means of Eclipse® with the PLCnext Technology Add-in. In 2020.x versions, both tools are bundled with each SDK.
    Note: If you're updating to firmware 2020.0 LTS as an Eclipse® Add-in user, you need to update the Eclipse® Add-in as well (see steps below). The Eclipse® Add-in now requires Java version 9 or above, while the Eclipse® IDE still depends on version 8.

PLCnext CLI and PLCnext Technology SDKs for different PLCnext Control devices are available at phoenixcontact.com/products in the download area of the product page for each PLCnext Control. See Tool downloads for an overview and direct links to the respective product pages on phoenixcontact.com .

Some sample applications programmed in C++ can be found at github.com/plcnext/CppExamples.

IDE

Before starting the installation, ensure that the system requirements are met:

For C# development with firmware 2021.6 or newer Phoenix Contact officially supports:
  • Microsoft Visual Studio 2019 (all editions)
For C++ development with firmware 2021.6 or newer Phoenix Contact officially supports:
  • Microsoft Visual Studio 2019 (all editions)
  • Eclipse IDE for C/C++ Developers 2021.03 R


In case of any issues with Eclipse:
We always test our release with the Eclipse release version 20xx.03 or 20xx.09, corresponding to the one before our release date. You can get Eclipse versions 20xx.03 R and 20xx.09 R from eclipse.org.


Installation steps

  1. Installing or updating the PLCnext Command Line Interface (PLCnext CLI)

    Installation stepsShow the steps on Windows 

    If installing for the first time:

    Run the installation file and follow the instructions of the installation wizard.

    In the following screen you see a list of essential and selectable options:

    • The option to set the environment variable is recommended by Phoenix Contact to have the best experience working with the PLCnext Toolchain on the command line.
    • The Microsoft® Visual Studio® extenstion is optional. This extension has to be installed via the setup. It is possible to select one or more installed Visual Studio® versions.
    • The Eclipse® Add-in will be placed as a .zip file in your PLCnext CLI installation folder for use in a further installation step.

    If updating an existing PLCnext CLI installation:

    Just start the installer and make sure to install to the same directory the previous PLCnext CLI was installed in.

    Installation stepsShow the steps on Linux 

    If installing for the first time:

    The following packages are required for installation in Linux:

    • xz-utils
      Required for SDK installation.
    • python3
      Required for SDK installation.
    • file
      Required for SDK installation.
    • build-essential
      The package contains the major part of the toolchain required for C++ programming, e.g., make.
    • libunwind8
      The EngineeringLibraryBuilder requires this library.
    • sshpass
      Is used by the debug script to query user name and password when logging in to the controller.

    To check if the packages were installed and to install them otherwise

    • Enter the following command:
      sudo apt-get install xz-utils python3 file build-essential libunwind8 sshpass
    • Run the PLCnCLI_Setup.sh file.
    • Read and accept the Software License Terms.

    You will then receive a folder named plcncli to which the PLCnext CLI was unpacked. Like for Windows, Phoenix Contact recommends to introduce the Executable file to simplify calling the file in the console.

    • For this, enter the following command:
      ln -s [Path_to_your_PLCnext_CLI_installation_folder]/plcncli /usr/local/bin/plcncli
      for example:
      ln -s /home/plcncli/plcncli /usr/local/bin/plcncli

    If updating an existing PLCnext CLI installation:

    • Delete the files and folders within the existing PLCnext CLI installation directory except the top level folder.
    • Install the newer version in that directory. By doing so, your settings files will not be touched. They are located in /home/<username>/.config/plcncli/.
    • In case you're working with the Eclipse IDE, restart Eclipse after updating the PLCnext CLI in the same directory as before. Eclipse should detect the new Add-in version and then will prompt you to update. If you chose to install the newer PLCnext CLI in another directory execute Check for Updates from the Help menu of Eclipse.

From here, the steps depend on your development environment:

 

For C++ development with Eclipse®

  1. Installing the Eclipse® IDE

    Installation stepsShow the steps 

    Phoenix Contact recommends the Eclipse® CDT development environment.

    • Download the Eclipse® CDT software with the "Eclipse IDE for C/C++ Developers" package from www.eclipse.org.
    • Copy and unpack the files to any folder.

    You can execute Eclipse® right away.

    Note: The Java™ Runtime Environment is required for the Eclipse® IDE. 

    If an error with "error code 13" occurs when Java™ is started, check if the correct Java™ version is installed. If you want to use a 64-bit Eclipse® version, you have to use a 64-bit Java™ version, too.

  1. Installing or updating the Eclipse® Add-in for PLCnext Technology

    Installation stepsShow the steps

    • If an earlier Eclipse® Add-in version is already installed, uninstall it: 
      1. Open the Help  > About Eclipse IDE menu:
        Eclipse_Help.png
      2. Click on the Installation Details button.
        Eclipse Installation Details
      3. Select the earlier add-in versions and uninstall them.
    • Check the Java version running on your system:
      for the Eclipse® Add-in 2020.0 LTS, Java v11 is required; if an update is needed:
      1. Finding the instructions
        Due to the fact that beginning with Java 8 Oracle requires subscription, you need to install and maintain later versions manually. You can find the instruction on the OpenJDK website - it's the first instruction at the top.
      2. Getting the packages
        To get the packages, we can recommend these two pages:
        • Oracle's Java.net, providing the current version and some early-access releases for future versions
        • AdoptOpenJDK, providing OpenJDK binaries and a build infrastructure
      3. Setting up the source in Eclipse®
        After installing the JDK version 11 or later, you have two options to set it up in Eclipse®:
        1. You can edit the eclipse.ini file, so that Eclipse is launched with the newer Java version (instructions see here)
        2. You can set your system environment variable JAVA_HOME to the new JDK (instructions see here)
    • Start Eclipse.
    • Open the Help →  Install New Software... menu.
      Eclipse Install new software
    • To select the path to the directory of the add-in, click on Add... in the Install dialog.
    • 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 PLCnext CLI under .../ide-plugins/com.phoenixcontact.plcnext.updatesite.zip.
    • Enter a name of your choice in the Name: input field and confirm with clicking the Add button of the pop-up dialog:
      Install Eclipse Add-in
    • Disable the Contact all update sites during install to find required software check box in the lower third of the dialog.
    • Click on the Next button.
    • Read and accept the licence agreements.
    • Click Finish to complete the installation.
    • Restart Eclipse® when you are prompted to do so.

    Updating the Eclipse® Add-in

    • Make sure to update the PLCnext CLI first (see step 1 above) in the same directory as before.
    • Restart Eclipse.

      Eclipse should detect the new Add-in version and then will prompt you to update.

    Note: If you choose to install the newer PLCnext CLI in another directory, follow the instructions for an initial installation of the PLCnext CLI above in this step 3.

  2. Installing an SDK using the Eclipse® Add-in

    Installation stepsShow the steps 

    To open the PLCnext Toolchain SDK management go to WindowPreferences, search for PLCnext and open the SDKs submenu.

    You will see a list of paths of all installed SDKs.

    Note: We recommend to organize your SDK paths like in the above screenshot, to easily identify its content.

    Install or add an SDK 

    Install... is used directly with the downloaded archive (tar.xz on Windows) and the destination is the path to install the SDK to.

    Note: Forcing the installation into a destination overwrites the original folder content.

     

    Add... is used for an already previously installed/unpacked SDK. Just select the dedicated folder and it will be added to the PLCnext Toolchain known SDKs.

    The installed/added entry in the list will appear blue.

    Click OK to apply the change or Cancel to revert all changes.


    Remove an SDK

    To remove an installed SDK, select the dedicated SDK from the list and click Remove.

    The entry in the list will appear gray.

    Click OK to apply the change or click Cancel to revert all changes.

    A popup will ask you for confirmation. You can select to remove SDK directory from your harddrive as well.

    Add or remove a project target

    To change the project targets, go to ProjectProperties, search for PLCnext Targets

    The Available Targets list on the left window side shows all installed SDKs. The Selected Targets list on the right window side shows all targets added to the project.

    • Add new targets by selecting an available target on the left and move it to the right via Add.
    • Remove targets by selecting an entry on the right and move it to the left side via Remove.
    • Apply and Close applies the setting and Cancel reverts all changes.

     

    Note: Targets with an red letter entry do not have the SDK installed on the PC.

Watch steps 2 to 4 in Tutorial videos (Windows/Linux)Watch steps 2 to 4 in Tutorial videos (Windows/Linux)

cookie

Note: Tutorial videos are embedded from the Phoenix Contact Technical Support YouTube channel.  With playing an embedded YouTube video in this platform, you accept the YouTube Terms & Conditions.
Depending on your personal settings in the Cookie consent dialog you may have allowed cookies for marketing purposes which will remain on your device. The data gained through this will be used by YouTube to provide video suggestions and advertisements based on your browsing habits, and may be made available to other parties. 

Installation on Windows

Duration 05m:22s    Resolution HDTV 720p    audio language English    subtitles language English

Installation on Linux

Duration 04m:57s    Resolution HDTV 720p    Audio language English    Subtitles language English

 

For C++ and C# development with Visual Studio®

  1. Installing the Visual Studio® IDE (C++ and C#)

    Installation stepsShow the steps

    Download the Visual Studio® IDE from the Microsoft® website

    Note: To work with the PLCnext C++ Extension you need at least Visual Studio® 2019 version 16.5.x including the following workloads:

    • .NET desktop development
    • Desktop development with C++
    • Linux development with C++
  2. Installing or updating the Visual Studio® Extension (C++ and C#)

    Installation steps Show the steps 

    The PLCnext CLI Extension for Visual Sudio 2019 can be installed via the PLCnext CLI setup(step 1 above). This enables templates, profiles, debugging (C# only) and other functionalities to develop in C# and C++ for the PLCnext runtime system.
    For C++ programming you also need to install an SDK, suitable for your installed firmware version (see next step 4).

  3. Installing or uninstalling an SDK using the Visual Studio® Add-in (C++)

    Show the stepsShow the steps

    To open the PLCnext Toolchain SDK management go to ToolsOptions, search for PLCnext Technology and open the SDKs submenu.

    You will see a list of paths of all installed SDKs.

    Note: We recommend to organize your SDK paths like shown in the above screenshot, to easily identify its content.

    Install or add an SDK

    Install... is used directly with the downloaded archive (tar.xz on Windows) and the destination is the path to install the SDK to.

    Note: Forcing the installation into a destination overwrites the original folder content.

    Add... is used for an already previously installed/unpacked SDK. Just select the dedicated folder and it will be added to the PLCnext Toolchain known SDKs.

    The installed/added entry in the list will appear blue.

    Click OK to apply the change or click Cancel to revert all changes.

    Remove an SDK

    To remove an installed SDK, select the dedicated SDK from the list and click Remove.

    The entry in the list will appear gray.

    Click OK to apply the change or click Cancel to revert all changes.

    A popup will ask you for confirmation and you can select to remove it from your harddrive as well.

    Add or remove a project target

    To change the project targets, right click on your project in the Solution Explorer and select PLCnext Technology → Set Targets.

    The Available Targets list on the left window side shows all installed SDKs. The Selected Targets list on the right window side shows all targets added to the project.

    • Add new targets by selecting an available target on the left and move it to the right via Add >>.
    • Targets can be removed by selecting an entry on the right and move it to the left side via << Remove.
    • Save and Close applies the setting and Cancel reverts all changes.

     

    Note: Targets with a red-letter entry do not have the SDK installed on the PC.

 

For C++ development with any other IDE or tool

  1. Installing your IDE or tool

    Follow the instructions coming with that software 

  2. Installing or uninstalling an SDK by means of the PLCnext CLI

    You can use the following options if you want to manage the target SDKs via terminal and not with one of our IDE extensions.

    Show the stepsShow the steps

    Install an SDK

    • Use te following command to install an SDK:
      plcncli install sdk

     

    • Use the following option to set the installation path. It must be an empty/not existing path:
      -d

     

    • Use the following option to set the path to the SDK archive. On windows a .tar.xz and on linux a .sh file is expected:
      -p

     

    plcncli install sdk –d [Installation path] –p [Path to archive file]

    Note: If you install several SDKs, Phoenix Contact recommends to use the "target name/firmware version" folder structure. Installing an SDK using the PLCnext CLI automatically makes the installation known to the PLCnext CLI.

     


    Get a list of available SDKs

    • Use the following command to get information about all installed SDKs:
      plcncli get targets

     

    • Use the following command to get a list of all installation paths of each SDK:
      plcncli get sdks

     


    Add or remove a project target

    • Use the following command to add or remove a project target:
      plcncli set target

     

    • Add the following mandatory options to the command:
      • -n → name of a target
      • -aadd a target or  -rremove a target
    • Add the following option to the command to specify the version to add/remove (if the target name is not exclusive):
       -v → version of target
    • Add the following option to the command to set the project path (if the current directory is the targeted project, this is optional):
       -p → project path for installation

     


    Get a list of all SDKs set for a project

    • Use the following command to get all project information including the project targets:
      plcncli get project-information

     

    • The following command returns a list of paths to all project SDKs. It additionally returns errors for not existing SDKs:
      plcncli get project-sdks

     

 

PLCnext Engineer (optional)

Importing a library into PLCnext Engineer describes how to import a PLM library and instantiate a program thereof.

To use PLM libraries build with the PLCnext CLI, at least the same release version of the PLCnext Engineer is needed. In Getting started with PLCnext Engineer you will find information on how to install and get started with PLCnext Engineer.

 

 


•  Web browser recommendation: Chrome/Edge 88 or newer, Firefox ESR 90 or neweror Safari • 
• Published/reviewed: 2022-09-14 • Revision 046 •