Category Compile

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.


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 TC3.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 TC3.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 1: (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 TC3.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 2: (Default): When the PLC project is created, no tpy file associated with the project is created.

Category Compile 3:: 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.

Solution options

Compiler Version

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

Please note that this setting is not a substitute for the Remote Manager.
If the PLC project is an application project, the Remote Manager should always be used for handling different Engineering versions.
In this case, the compiler version should always be set to "latest".

The compiler version setting is only relevant if the PLC project to be version-managed is a library project.
It is advisable to save the oldest version of the library that will ultimately be used in practice. 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 4:: 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 5: (Default): Access to constants is possible. The computing time increases slightly.

See also: