Integrating external libraries for the C-blocks or C++-blocks

Previous: Entering code within the C-block or C++-block


How to integrate external C-libraries or C++-libraries, if they are used within your →blocks in →C or →C++:

  1. In the project explorer: Select the project in which you have created the interface for the C-blocks or C++-blocks.
  2. In menu Project, select Properties.
  3. In the properties, expand group PLC-Object and select Settings for C-Blocks

  4. Define the following properties for the platform for which you want to integrate external C-libraries or C++-libraries:

    1. Under Target platform, select the platform (e.g. WindowsX86).

    2. Enter the required paths/names in the input fields.

      Input field forPurpose
      Include path

      one or more additional include folders for your own header files (separated by ;)
      Example 1: c:/myheader/inc 
      Example 2: c:/myheader/inc;c:/myheader/h
      Example 3: ../../../myheader/inc – This corresponds to the sub-folder myheader\inc of the current project.
      It is possible to enter absolute and relative paths (both to be entered with /). Start a relative path always with ../../../ – this corresponds to the folder of the current project.
      But it is also possible to use the variable ${PROJECT_LOC} in order to specify the folder of the current project.

      Library name

      one or more names of the C-libraries or C++-libraries to be integrated (separated by ;)
      Example 1: library1 
      Example 2: library1;library2
      logi.cals recommends the usage of unique names for the libraries. Then you can be sure that logi.CAD 3 integrates the correct library in the appertaining path.
      Observe that you have to enter other names than those shown in the file system:

      PlatformName of library (in the file system)Input in the field
      WindowsX86TestW.libTestW
      LinuxX86, Raspbian, Mica, RevolutionPilibTestR.aTestR
      phyboardRegor, phyboardWegalibTestP.aTestP
      uMIC200libTestM.aTestM
      Econ100libTestE.aTestE
      Library path

      one or more paths to the folders with the C-libraries or C++-libraries to be integrated (separated by ;)
      Example 1: c:/library1 
      Example 2: c:/libraries/lib1;c:/libraries/lib2
      Example 3: ../../../libraries/lib1 – This corresponds to the sub-folder libraries\lib1 of the current project.
      It is possible to enter absolute and relative paths (both to be entered with /). Start a relative path always with ../../../ – this corresponds to the folder of the current project.
      But it is also possible to use the variable ${PROJECT_LOC} in order to specify the folder of the current project.

      Additional source file path

      one or more paths to the folders with additional source files (separated by ;) so that these files are considered for the generated code
      It is possible to enter absolute and relative paths (both to be entered with /). Start a relative path always with ../../../ – this corresponds to the folder of the current project.
      But it is also possible to use the variable ${PROJECT_LOC} in order to specify the folder of the current project.

      Observe:

      • Only files with extensions .c and .cpp are considered. Other files within the folders are ignored.
      • Specified folders are searched recursively for C/C++ files.
      Additional code generators:

      depending on the extended version of  logi.CAD 3 : a list of additionally available code generators
      By default, the code generators are enabled. If required, uncheck the code generator for the current project.

    3. Click Apply so that the settings for the platform are applied.
  5. If you want to integrate external C-libraries or C++-libraries for other platforms as well, repeat the last step (number 4) for each platform.

  6. Click OK in order to close the dialog with the properties.

If you load the application onto the PLC now, the defined C-libraries or C++-libraries are included.