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/CppExamples.

Installation steps

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

    Installation stepsShow installation steps 

    If installing for the first time:

    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

    If updating an existing PLCnext CLI installation:

    Updating under Windows

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

    Updating under Linux
    • 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.
    • In case you're working with the Visual Studio Extension, reinstall the extension as described below after updating the PLCnext CLI. This way, the extension is updated, too.

 

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 or updating the Eclipse® Add-in for PLCnext Technology

    Installation stepsShow installation steps

    • If already installed, uninstall earlier Eclipse® Add-in versions as described in this drop-down section in this drop-down section 
    • Check the Java version running on your system:
      for the Eclipse® Add-in 2020.0 LTS, Java v11 is required How to updateHow to update
    • Start Eclipse.
    • Open the Help →  Install New Software... menu. Show a screenshotShow a screenshot
    • 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®.

    Updating the Eclipse® Add-in

    • Make sure to update the PLCnext CLI first (see step 1 above).
    • 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.
  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.  With playing an embedded YouTube video in this platform, 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® IDE

    Installation stepsShow installation 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

  2. Installing or updating 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 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®.

    Updating the Visual Studio® Extension

    • Make sure to update the PLCnext CLI first (see step 1 above).
    • Reinstall the Visual Studio® Extension as described at the beginning of this section. This way, the extension is updated, too.
  3. 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 any other IDE or tool
    1. Follow 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: 2021-04-19 • Revision 019 •