Category Compile

Category Compile 1:

Scope of PLC project properties

Note that the scope differs between different project properties!
Some properties affect only the PLC project whose properties you are currently configuring.
Other properties, on the other hand, affect all PLC projects in the development environment. Such properties, which you can change in the project properties of a PLC project, but which also affect all other PLC projects, are titled Solution options.

The category Compile is used to configure the compiler options.

Settings

Compiler definitions

Here you can enter compiler definitions/"defines" (see {define} statements) and conditions for compiling the application (conditional compilation).

A description of the available conditional pragmas can be found in section Conditional pragmas. The expression expr used in such pragmas can also be entered here. Several entries are possible in the form of a comma-separated list.

System compiler definitions

Available from TwinCAT 3.1 Build 4024

The compiler definitions that have been set at System Manager level in the PLC project settings under Compiler definitions are automatically adopted here.

Download application info

Available from TwinCAT 3.1 Build 4024

Situation: You are loading a PLC project onto the controller that differs from the project already located there. In this case, a message window appears containing a Details button. Use this button to open the Application information window, which allows you to check the differences between the current PLC project and the PLC project on the controller. This involves comparing the number of function blocks, the data and the storage locations.

The Application information window contains a brief description of the differences, for example:

  • Declaration of MAIN changed
  • Variable fbMyNewInstance inserted in MAIN
  • Number of methods/actions of FB_Sample changed

Category Compile 2: (Default): If this setting is enabled, the information on the contents of the PLC project is loaded onto the PLC. This enables an extended check of the differences between the current PLC project and the PLC project on the controller. The difference in the extended check option is that the Application information window contains an additional Online comparison tab, which shows a tree comparison view. This will tell you which POUs have been changed, deleted or added. The additional tab appears when you execute the blue underlined command in the lower area of the Application information window ("Application not current. Generate code now to display the online comparison?").

Generate tpy file

Available from TwinCAT 3.1 Build 4024

The tpy file contains, among other things, project, routing, compiler and target system information. It is the format used for describing a TwinCAT 2 PLC project. To ensure compatibility with existing applications, this file can be created for a TwinCAT 3 PLC project, if required.

Category Compile 3: (Default): When the PLC project is created, no tpy file associated with the project is created.

Category Compile 4:: When the PLC project is created, a tpy file associated with the project is created and stored in the project folder.

 

Please note that the value and configuration availability of this option depends on whether or not the TPY file is configured as a target file (see Settings tab).

  • If the TPY file is enabled as a target file, the following happens:
    • TwinCAT remembers the current status of the "Generate tpy file" option (= "original value", see below.).
    • If this is not already the case, the option "Generate tpy file" is automatically activated next time the project is created.
    • In addition, the "Generate tpy file" option is grayed out so that it cannot be disabled by the user as long as the TPY file is configured as a target file.
  • If the TPY file is subsequently disabled as a target file, the following happens:
    • Next time the project is created, the "Generate tpy file" option is assigned its "original value" (see above.).
    • In addition, the option is no longer grayed out, making it available again for configuration by the user.

Add initialization values of declarations to the TMC file

Available from TwinCAT 3.1 Build 4026.12

Category Compile 5: (Default): Initialization values of declarations are saved in the TMC file. This is useful, for example, if the initialization values are required for other applications.

Category Compile 6:: Initialization values of declarations are not saved in the TMC file. This reduces the size of the TMC file and the compilation time, especially if the declarations in the PLC project contain a large number of initialization values.
Sample:

VAR
    aSample : ARRAY[1..10] OF INT := [2, 38, 5, 9, 74, 62, 87, 3, 16, 4];
END_VAR

Add comments on POU and DUT declarations to the TMC file

Available from TwinCAT 3.1 Build 4026

Category Compile 7: (Default): Comments on POUs and DUTs that are above their declaration are saved with the data type in the TMC file. This is useful, for example, if the comments are required for other applications.

Category Compile 8:: Comments above the declaration of POUs and DUTs are not saved in the TMC file. This reduces the size of the TMC file and the compilation time, especially if the comments contain detailed descriptions of the POUs and DUTs.

Sample:

// This function block represents an axis
FUNCTION_BLOCK FB_Axis

Solution Options

Compiler Version

Defines the compiler version that TwinCAT uses during compilation and during loading for compilation.

Please note that this setting does not replace the Remote Manager.
For handling different engineering versions, if the PLC project is an application project, the Remote Manager should always be used.
The compiler version should always be set to "latest" in this case.

The compiler version setting is only relevant if the PLC project to be version-managed is a library project..
It is recommended that the library is saved with the oldest version with which it is ultimately to be used. To this end, the compiler version must be set to the corresponding fixed version (e.g. "3.1.4018.0").

Maximum number of warnings

Refers to the maximum number of warnings that TwinCAT issues in the Error List view.

The selection of displayed compiler warnings is defined in the category Compiler warnings in the Project Settings dialog.

Replace constants

Category Compile 9:: TwinCAT loads the value directly for each constant of scalar type, i.e. not for STRING, ARRAY or structures. In online mode, TwinCAT identifies the constants in the declaration editor or monitoring window with a symbol preceding the value. In this case, access via an ADR operator, forcing or writing, for example, is not possible.

Category Compile 10: (Default): Access to constants is possible. The computing time increases slightly.

See also: