From the errors you mention, it looks like you manually created a Release configuration for a CubeMX generated project as, regretfully, CubeMX only generates a Debug configuration for the project.
Eclipse is able to keep all configurations up-to-date with the include file directory specifications, but only for existing configurations, not configurations that are created later on...
You thus have two alternatives:
- Only work in Debug mode; if the Debug mode works why change it?
- You will deliver code that is not properly tested (except if you fully test it again in Release mode);
- Moreover the delivered code will not be debuggable so quite hard to fix if an error is later on detected
- Rather than switching to a Release configuration (that optimize and do not provide debug information) you should consider just increasing the optimization level of the Debug configuration
- Then the final code will still be debuggable (although sometime a bit strange debug behavior can be due to optimizations) so the delivered code will be simpler to fix in case of error.
- Create a Release configuration by importing the Debug configuration then adapt the optimize and debug options.
Hope these clarifications will help; hopefully, in a forthcoming release, we can expect CubeMX to generate the Release configuration; ST is aware of the problem and should fix it.