[Coin-discuss] Question about BuildTools?

Stefan Vigerske stefan at math.hu-berlin.de
Tue Nov 6 05:05:47 EST 2012


Hi,

in the COIN-OR buildsystem, debug builds (from --enable-debug) are 
compiled without -DNDEBUG in the compiler flags, while default 
(optimized) builds are done with -DNDEBUG.
The latter leads to have NDEBUG defined when the C/C++ preprocessor is 
running.
So your debugging code should go into a #ifndef NDEBUG / #endif.

I think this is fairly standard behavior and not specific to Windows or 
COIN-OR.

There is nothing that defines _DEBUG, as far as I know. You can add this 
define by configuring with ADD_CFLAGS=-D_DEBUG and ADD_CXXFLAGS=-D_DEBUG.

Stefan

On 11/05/2012 08:42 PM, Horand Gassmann wrote:
> Hi,
>
> I am just experimenting with some build issues and am wondering if there
> is a *nix equivalent to the Windows environment variables _DEBUG and
> NDEBUG. These variables make it very convenient for me to put debug
> statements into the code by hiding them behind
>
> #ifdef _DEBUG
> ...
> #endif
>
> without having to worry about performance issues in the production code
> --- the compiler filters all that out for me. But it seems that in the
> unix world this is not available; the compiler command
>
> g++ -g -O0 ...
>
> does not set any environment variables that I can see. Is there anything
> else I can do to duplicate the Windows functionality? Would I have to
> write something into configure.ac?
>
> Thanks for any ideas.
>
> Cheers
>
> gus
>
> -------------------------------------------------------
>
> Horand I. Gassmann, Professor
>
> Kenneth C. Rowe School of Business, Dalhousie University
> 6100 University Avenue, PO Box 15000
> Halifax, Nova Scotia, Canada, B3H 4R2
> ph. (902) 494-1844
> fax (902) 494-1107
>
> http://myweb.dal.ca/gassmann/
>



More information about the Coin-discuss mailing list