Avoiding full paths in the output file
Technical Note 59374
12/12/2022 8:49 AM
In many projects, full paths are not wanted in the output file.
When the output file contains full paths, the build will be different if rebuilt at another location.
The typical reason for this problem is that the application uses the
assert macro, which in turn uses the
__FILE__ preprocessor symbol. The macro
__FILE__ expands to the full path of the current file.
Another reason for this problem is when building the debug configuration at another location.
- Avoid Assert
You can use conditional compilation to avoid assert messages. The file
installation_path\target\inc\c\assert.huses the following construction to avoid assert messages being built into the output file, which is generated in the release configuration:
#define assert(test) ((void)0)
- Exclude the path in macros
You can do this by using the following option in Project > Options > C/C++ Compiler > Extra Options:
- Building with debug information
Debug information uses full paths to refer to source files. To get deterministic output in this scenario, you need to build at the same location.
Use the suggestions in this technical note to avoid full paths in the output file.
There might be other reasons for differences in the output file. For more information, see technical note 221111.
All product names are trademarks or registered trademarks of their respective owners.