Troubleshooting         Frequently Asked Troubleshooting Questions
Print
My Ogre application builds fine, but when I run it I get an assert about ms_singleton. Help!

 
Quite often, the singleton assert caused by trying to run Debug DLLs with code linked against Release libs, or vice versa. It may not be your actual linkage either. In plugins.cfg (or the equivalent programmatic method) if you specify Debug plugins and you are running Release code (or vice versa) this will happen when the opposite DLL build type is loaded.

For example, your program links against OgreMain.lib (release) but you are referencing, say ParticleFX_d.dll (debug). When ParticleFX_d.dll is loaded, it will load in turn OgreMain_d.dll (which is what IT was linked against), and then you have a problem. This is one of the reasons it always happens in the Singleton code: Two of something exist for a class that should only have one instance. Instant assert.

The Dependency Walker(external link) tool (Win32 only — Linux users can use the ldd command) is an invaluable aid in determining which modules your libraries and executables are using, and can sometimes turn up unexpected dependencies. Note that running this with your program will not scan the plugins, since they are not compile-time linked to the program; you'll need to run it for each plugin as well.

Make sure you are referencing the correct plugins, either in plugins.cfg (when using that method) or in your code when loading plugins via code. In your project files in -VisualStudio, make sure you are linking against the intended import libraries (.lib files), Ogre marks its Debug builds with a _D suffix on its DLL filenames.


Alias: TroubleshootingFAQ


Contributors to this page: spacegaier3733 points  , OgreWikiBot and jacmoe111451 points  .
Page last modified on Tuesday 15 of December, 2009 11:07:28 GMT by spacegaier3733 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.