Custom Build actions and Project Clean

Technical Note 83760



2/2/2015 1:18 PM


In a project using Custom Build, Custom Build actions may be done too late (or too early) after

Project -> Clean

has been done. The diagnostic message seen can be:

Fatal Error[Pe1696]: cannot open source file

Is this my issue?

Please try

• Project -> Clean
• Project -> Rebuild all

 IF your custom build actions appear too late in the build log, possibly together with

Fatal Error[Pe1696]: cannot open source file [...]

it is likely that you have this problem. You may need to change message filtering level (Tools -> Options) to see custom build actions in the build log.

Possible solution (From IarIdePm.exe version 7.1.5)

Use "Run this tool before all other tools" as illustrated in screen dump.

Possible solution (From IarIdePm.exe version 6.6)

Choose file names to get appropriate sort order, for example

  1. __custom_build_early.cfg
  2. depends_on_custom_build_early.c

Possible solution (older versions of IarIdePm.exe)

Solution 1


Project -> Clean

(In most cases, with or without Custom Build actions

Project - > Rebuild all

should be enough. )

Solution 2


Project - > Clean


Project - > Make

until the dependency file (extension .dep) has been properly reconstructed. Twice should be enough in most cases (complex projects with multiple levels of custom build action dependencies may require more).

Example (IAR Embedded Workbench for ARM version 6.60)

Using the example project Example

  • Load workspace
Project -> Clean
Project -> Make

      __CustomBuild.h OK (created before it is needed)

     zzCustomBuild.h reported missing (created too late)

Project -> Make

     __CustomBuild and zzCustomBuild both OK
     Dependencies reconstructed.


  • The consequence of
  • Project -> Clean

     is that the dependency file (extension .dep) is cleared. When starting from scratch, dependencies are built incrementally.

  • Project -> Rebuild all
    does NOT clear the dependency file.
  • You may want to check the screen dump CustomBuild.png (in the zip-file) and/or
  • Project -> Options -> Custom build

     in the example project for details of the trivial Custom Build action used.

  • IAR internal references 399247s_IAR, IDE-1734

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.