Application Switch Files and Compile Flags |
Top Previous Next |
There are a few different ways to control whether your application is built with debug logging compiled in and enabled.
For basic introduction on setting the flags or commandline options, see the introductory topic, which explains how to modify the values in the jrdebug_switch.h file to configure compilation.
Different options for different applications: The reason that we use a separate file (jrdebug_switch.h) to hold the flags to enable compilation is to accomodate users who want to use a single copy of the JrDebugLog header files, but want to be able to configure multiple applications differently. Because of compilation order issues, you cannot simply add the compilation #define macros to your own application code.
The way to accomplish this is to make a *copy* of the jrdebug_switch.h file inside your application directory. Then *REMOVE* this file from the main DebugLibrary directory containing jrdebug.h (you may have to adjust your project include directory paths to make sure it will look in your application directory). In this way, when your applications are compiled, and jrdebug.h tries to #include jrdebug_switch.h, it will find the copy in your application directory, allowing you to use different versions of jrdebug_switch.h for each application.
Overiding jrdebug_switch.h: You may also overide the settings in the jrdebug_switch.h file by passing options to your c++ compiler. Use the -DJrDebugNoSwitchfile to tell the compiler not to parse the switch file. You can then add -DJrDebugDIRECTIVE_StartupDisabled or -DJrDebugDIRECTIVE_DontCompileDebugging to set the mode explicitly.
Disabling Windows-specific Extras when Building on Windows: It may be useful to test compiling your code with debugging and avoiding ANY windows-related functions and includes from the JrDebug files; these are normally used to add some extra functionality like determining a safe path to store relative debug files if they can't be saved in application folder under Vista/Win7. To do this, add the -DJrDebugDIRECTIVE_PretendNonWindows directive.
|