Required Installations for C++ programming

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.

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

Installation steps

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

    Installation stepsShow installation steps 

    Installing under Windows

    • Run the installation file and follow the instructions of the installation wizard.
    • Phoenix Contact recommends to add the installation directory to the PATH variable in the Windows® environment variables.

    Installing under Linux

    The following packages are required for installation in Linux:

    • xz-utils
      Required for SDK installation.
    • python3
      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 build-essential libunwind8 sshpass

    • 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 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 the PLCnext CLI installation folder]/plcncli /usr/local/bin/plcncli
     e.g.:

    ln -s /home/plcncli/plcncli /usr/local/bin/plcncli

For C++ development with Eclipse®

  1. Installing the Eclipse® IDE

    Installation stepsShow installation steps 

    Phoenix Contact recommends the Eclipse® CDT development environment.

    Note: 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 want to use a 64-bit Eclipse version, you have to use a 64-bit Java version, too.

    • 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.

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

    Installation stepsShow installation steps

    • If necessary, uninstall earlier Eclipse® Add-in versions as described herehere
      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 v9 is required How to updateHow to update
      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 9 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. Show a screenshotShow a screenshot
      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®.
  2. Installing an SDK using the Eclipse® Add-in

    Installation stepsShow installation steps 

    To install new SDKs or manage already installed SDKs out of Eclipse®, you can use the PLCnext CLI SDK settings.

    • In Eclipse®, select Window → Preferences
    • Under the PLCnext entry, select SDKs

    Now you can:

    • see the Installed SDKs
    • Add SDKs that have already been unpacked
    • Install SDKs from a packed archive
    • Remove SDKs from the PLCnext CLI (but keep them on the hard drive for further use), or remove SDKs from the PLCnext CLI and from the hard drive

    When all is done, press Apply and Close to see the changes you've made.

Watch steps 2 to 4 in a Tutorial VideoWatch steps 2 to 4 in a Tutorial Video

cookie

Note: Tutorial videos are embedded from the Phoenix Contact Technical Support YouTube channel.  When you start playing an embedded YouTube video, you accept the YouTube Terms & Conditions. That includes digital "cookies" for marketing purposes which will remain on your device. The data gained through this will be used to provide video suggestions and advertisements based on your browsing habits, and may be sold 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++ development with Visual Studio®

  1. Installing the Visual Studio® Extension

    Installation steps Show installation steps 

    This tool for C++ programming comes bundled with each SDK version  and newer). After installing the PLCnext CLI (see step 1 above), the for the Visual Studio® Extension installer is available on your computer. 

    • Navigate to the installation folder of the PLCnext CLI and to the .../ide-plugins/PlcNextVSExtension.vsix installation file
    • Execute the file and follow the Wizard's instructions; the Wizard will automatically check for required versions of Visual Studio® and modules.
    • Restart Visual Studio®.
  2. Installing or uninstalling an SDK by means of the PLCnext CLI

    Installation stepsShow installation steps 

    Obtaining an SDK

    • Download the SDK that is suitable for your controller from the download area of your controller at phoenixcontact.net/products.
    • 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-toolchain-2019.0.tar.xz
      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.

    Introducing an SDK

    • To introduce already unpacked SDKs to the CLI, enter the following command:
      plcncli.exe set setting SdkPaths –a [Path to SDK]
      E.g.:
      plcncli.exe set setting SdkPaths –a 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 SdkPaths –r [Path to SDK]
      E.g.:
      plcncli.exe set setting SdkPaths –r C:\CLI\SDKs\AXCF2152\2019_0\

    The uninstalled SDK is removed from the PLCnext CLI, but will be retained in the directory system.

 

For C++ development with any other IDE or tool

  1. Installing your IDE or tool
    by following the instructions coming with that software 
  2. Installing or uninstalling an SDK by means of the PLCnext CLI

    Installation stepsShow installation steps 

    Obtaining an SDK

    • Download the SDK that is suitable for your controller from the download area of your controller at phoenixcontact.net/products.
    • 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-toolchain-2019.0.tar.xz
      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.

    Introducing an SDK

    • To introduce already unpacked SDKs to the CLI, enter the following command:
      plcncli.exe set setting SdkPaths –a [Path to SDK]
      E.g.:
      plcncli.exe set setting SdkPaths –a 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 SdkPaths –r [Path to SDK]
      E.g.:
      plcncli.exe set setting SdkPaths –r C:\CLI\SDKs\AXCF2152\2019_0\

    The uninstalled SDK is removed from the PLCnext CLI, but will be retained in the directory system.

 

 

 

 


 • Published/reviewed: 2020-09-18 • Revision 004 •