Allen Bierbaum wrote: > Patrick Hartling wrote: >> Allen Bierbaum wrote: >>> I was just trying to track down why an FDEBUG macro was not working and >>> I think I found the cause. It looks like OSG_DEBUG is never being >>> defined on Linux because the build is not defining _DEBUG. >>> >>> Can any one else confirm this problem? >> _DEBUG is a Visual C++-ism AFAIK whose primary (sole?) purpose is to >> indicate the use of the Visual C++ debug runtime during compilation. I know >> for sure that some Windows headers check for the usage of this symbol and >> declare one function or another depending on whether it is being used. You >> should consider carefully whether you want to use it on other platforms. > > Is there something similar for gcc?
In general, I don't think you'll find other debug runtime implementations similar to what Visual C++ includes. At least I haven't seen it with other compilers. You could compile GLIBC (or other libc implementation) with debug symbols, but the run-time checks that the Visual C++ debug runtime does are not necessarily going to be there. The salient point here is that there is a difference between building object files with debug symbols and using the Visual C++ debug runtime. > As it stands right now, OpenSG 2.0 is setup like this: > > (see OSGConfig.h) > > #ifdef _DEBUG > #define OSG_DEBUG > #endif > > So AFAIK OSG_DEBUG is never defined on non-windows platforms. I think > we need to do one of: > > 1. Define _DEBUG on non-windows platforms as part of the cxxflags when > building debug. To be more clear, defining _DEBUG explicitly on any platform seems like a bad idea IMHO. Its meaning with Visual C++ doesn't necessarily translate anywhere else. For cross-platform behavior, I think it's better for a library to expect the same thing (preprocessor symbol definition in this case) on all platforms. Since _DEBUG doesn't have a cross-platform meaning, it shouldn't be defined explicitly. Let Visual C++ define it implicitly when the /MDd option is used. > 2. Change the ifdef to use something that works with gcc. I believe that OpenSG 1.x requires users to define OSG_DEBUG if they want to indicate the use of OpenSG debugging features--or at least that's the case on Windows. I would have to watch the 1.x build, but it seems logical that it would define OSG_DEBUG when compiling OpenSG with debugging capabilities enabled. Thus, it seems to me that OSG_DEBUG should be defined when you know you want to enable OpenSG debugging features--including when building OpenSG. > Anyone have ideas for a good fix? Debug OSG_DEBUG explicitly in the build when debugging features are desired. -Patrick -- Patrick L. Hartling VP Engineering, Infiscape Corp. http://www.infiscape.com/
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
