Why does the compiled and linked executable file contain paths of header files included in my source code? I am using the wxWidgets library and compile with Visual Studio 2013 and gcc. What are these header files used for? If it is a compiler option, how can I disable it to avoid this?
Build configuration: release, static linking.
Header files serve two purposes. System header files declare the interfaces to parts of the operating system. You include them in your program to supply the definitions and declarations you need to invoke system calls and libraries.
A binary executable file is a file in a machine language for a specific processor. Binary executable files contain executable code that is represented in specific processor instructions. These instructions are executed by a processor directly. A binary file, however, can have text strings (ASCII and/or Unicode).
Now, in Linux you'll often hear "binaries" when referring to "binary executable files" - programs. This is because while sources of most programs (written in high-level languages) are plain text, compiled executables are binary. Since there are quite a few compiled formats (a.
Source code files represent the computing language-specific data declarations and instructions that constitute a software module, routine, procedure, or class. A source code file is intended to be compiled into an executable binary file that can be run on the target computing system.
There may be several explanations for such strings to appear in the executable file:
strip
to remove that, or do not use the -g
compile option. You should also compile with NDEBUG
defined to disable debugging code and assertions. It is usually the case for the Release mode, but you may want to double check.__FILE__
for tracing or logging purposes. __FILE__
expands to the source file name at the point of macro expansion, which may be a source or a header file. One such function is assert()
: it is actually a macro that expands to a test and some error reporting code that includes the current filename.static char
arrays to keep track of source code versions. This approach is quite obsolete, but many old sources still have them.Look for such things in the source files or header files whose name appear in the executable and fix the problems.
wxwidgets has many asserts in its header files (e.g. in wx/string.h
as you noticed), all using the wxASSERT
macro defined in wx/debug.h
In order to disable these, you can #define wxDEBUG_LEVEL 0
prior to including any wxwidget headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With