Checking Syntax

When you input code, the precompile in CODESYS already runs some basic checks. Then, wavy underlines appear under buggy code in the editor and an error message is printed to the messages view.

After programming, you must check the syntax of the application by clicking Build ‣ Build or by pressing F11. In this step, the compiler checks the program and prints any other errors.

CODESYS automatically generates the application code from the source code that was written in the development system. This is done automatically before downloading the application to the controller. Before the application code is generated, a test is performed for checking the assignments, the data types, and library availability. In addition, the memory addresses are allocated when the application code is generated. You can execute this command explicitly by clicking Build ‣ Generate code. This is useful for detecting any errors in your source code, even when the controller is not connected yet.

CODESYS prints all errors and warnings to the “Build” category of the messages view. Double-clicking the error message opens the respective POU in the editor with the buggy code marked. As an alternative, you can also jump to the buggy code by right-clicking the error message.

Please note the settings for this in the CODESYS options.

See also