[osg-users] New way to workaround MSVC False Positives

Can T. Oguz ctoguz at gmail.com
Thu Mar 26 09:24:43 PDT 2009


Hi OSG Users,

I think I've found an easier work around to overcome the MSVC false
positives. I had been using the prescription at
http://www.vis-sim.com/3dsceneBB/viewtopic.php?t=1027 to avoid the leak
false positives for my desktop application and it worked perfectly but now
I've packed the source into an MFC ActiveX and I saw that all leaks came
back. So I've removed all the additional dependencies and linked the dlls by
the directives and all the false positives are gone. I've tested the leak
detection and it worked ok.

The new workaround is :

. Goto project settings. In there, make the following changes for theDebug
build.
. General->Use of MFC->Use Standard Windows Libraries.
. Add _AFXDLL to C/C++->Preprocessor->Preprocessor Definitions.
. Add the following pragma directives to stdafx.h right after the MFC
includes:

#ifdef _DEBUG
  #pragma comment(lib, "OpenThreadsd.lib")
  #pragma comment(lib, "osgd.lib")
  #pragma comment(lib, "osgDBd.lib")
  #pragma comment(lib, "osgUtild.lib")
  #pragma comment(lib, "osgGAd.lib")
  #pragma comment(lib, "osgViewerd.lib")
  #pragma comment(lib, "osgTextd.lib")
  #pragma comment(lib, "osgSimd.lib")
#else
  #pragma comment(lib, "OpenThreads.lib")
  #pragma comment(lib, "osg.lib")
  #pragma comment(lib, "osgDB.lib")
  #pragma comment(lib, "osgUtil.lib")
  #pragma comment(lib, "osgGA.lib")
  #pragma comment(lib, "osgViewer.lib")
  #pragma comment(lib, "osgText.lib")
  #pragma comment(lib, "osgSim.lib")
#endif

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

Regards,

Can
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090326/3747b95c/attachment-0002.htm>


More information about the osg-users mailing list