Compilation Feedback
Real-time compilation errors and warnings
Compilation Feedback
PLC Studio AI provides real-time compilation feedback, showing you errors and warnings as soon as changes are applied.
How It Works
When you accept code changes:
- The bridge sends the updated code to CODESYS
- CODESYS compiles the project
- Compilation results are sent back to PLC Studio AI
- Errors and warnings appear in the interface
This happens automatically—you don't need to manually trigger compilation.
Understanding Compilation Results
Success
When compilation succeeds, you'll see:
- A green checkmark indicator
- "Compilation successful" message
- Any warnings (if present)
Errors
When compilation fails, you'll see:
- A red error indicator
- List of errors with line numbers
- Error descriptions from CODESYS
Warnings
Warnings don't prevent compilation but indicate potential issues:
- Yellow warning indicator
- List of warnings with locations
- Suggestions for resolution
Error Display
Errors appear in the Problems panel:
Errors (2)
├─ FB_Motor.st:15 - Identifier 'bStrat' not defined
└─ FB_Motor.st:23 - Type mismatch: Cannot convert REAL to INT
Warnings (1)
└─ FB_Pump.st:8 - Variable 'rTemp' is declared but never usedClick on any error to jump to that location in the code.
Common Error Types
Syntax Errors
Error: Unexpected token 'THEN' at line 12Cause: Missing or incorrect syntax Fix: Check for missing semicolons, keywords, or parentheses
Undefined Identifiers
Error: Identifier 'bStartMotor' not definedCause: Variable or function not declared Fix: Declare the variable or check spelling
Type Mismatches
Error: Type mismatch: Cannot assign REAL to INTCause: Incompatible data types Fix: Use explicit conversion (REAL_TO_INT) or change variable type
Missing Declarations
Error: Variable 'counter' must be declaredCause: Using a variable without declaring it Fix: Add the variable to the appropriate VAR section
AI-Assisted Error Fixing
When you encounter errors, you can ask the AI for help:
"Fix the compilation error on line 15"
"Why am I getting a type mismatch error?"
"The compiler says 'bStart' is undefined, but I declared it"The AI can:
- Explain what the error means
- Suggest fixes
- Apply corrections automatically
Error Prevention
Enable Real-Time Checking
PLC Studio AI can catch some errors before compilation:
- Syntax highlighting shows issues
- Type checking warns about mismatches
- Missing declarations are flagged
Use Autocomplete
The AI-powered autocomplete suggests:
- Valid variable names
- Correct function signatures
- Appropriate data types
Follow Best Practices
- Declare variables before use
- Use consistent naming conventions
- Keep functions focused and small
Compilation Settings
You can configure compilation behavior in Settings:
| Setting | Description |
|---|---|
| Auto-compile | Compile automatically after accepting changes |
| Show warnings | Display warning messages |
| Strict mode | Treat warnings as errors |
Troubleshooting
Compilation Not Running
If compilation doesn't run:
- Check that the bridge is connected
- Verify CODESYS is open with your project
- Try reconnecting the bridge
Errors Not Clearing
If errors persist after fixing:
- Save all files in CODESYS
- Trigger a manual compile in CODESYS
- Restart the bridge
Inconsistent Results
If PLC Studio AI shows different errors than CODESYS:
- Sync may be out of date—refresh the connection
- Check for unsaved changes in CODESYS