P6009¶
- Code
P6009
- Message
Output path conflicts with an input file
This error occurs when the output of ironplcc compile refers to an input source file. Writing the compiled container would replace the source text, so the compiler rejects the path before opening the output file.
Example¶
The following command uses main.st as both the input and the output:
ironplcc compile main.st --output main.st
Choose a different output path so the source file remains unchanged:
ironplcc compile main.st --output main.iplc
Why the Compiler Rejects the Path¶
The compiler writes a binary container after it finishes parsing, analysis, and code generation. Creating the output file truncates it first, so opening an input source as the destination would discard the program before any container bytes are written. The command could otherwise report success even though the original source had been lost.
IronPLC compares the resolved files rather than the path text. Using an absolute path for one argument and a relative path for the other, or referring to the source through a symbolic link, therefore does not bypass the check. Existing output files that do not refer to an input source are still overwritten as usual.
Directory Projects¶
The same rule applies to files discovered from a project directory. This
command is rejected when project/main.st is one of the discovered
sources:
ironplcc compile project --output project/main.st
Write the container outside the source set instead:
ironplcc compile project --output project/main.iplc
See Also¶
P6001 explains failures while resolving a path.
Compiler command line describes compiler actions and arguments.
Think IronPLC is wrong about this?
If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.