Exception thrown when building Tut0

lakersforce

23-01-2009 16:43:50

I managed to almost get all the way through the tutorial 0. (phew, that wiki page is seriously outdated!)

When I build the program (Programm.cs) I get an exception thrown. I can't replicate it excactly here, because I was only given the details in the first run (subsequent runs give less details).

The error is thrown when (m)ogre tries to instantiate the root. The first time I encountered it, I was asked to give the location of a <some name here, probably somthing with "root" in it>.cpp file.

I have read the thread http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=9031.

I have tried to change to a release build (my references was linked to Mogre.dll and MogreFramework.dll in C:\MogreSDK\...\release). Did't help! I changed my references to the MogreSDK debug library and ran a debug build. Did't help!

I have tried to use the default MogreFramework.dll, the updated one found on this forum and one I've build myself. Didn't help!

HELP!!

lakersforce

23-01-2009 18:03:37

Perhaps it would be worth mentioning that I use Mogre 1.4.8.

raygeee

23-01-2009 19:24:53

Could you post the exception message, the exception stacktrace (and the content of the file ogre.log if it got created)? Or at least some of those infos?
Without more specific error information it's hard to tell and the reason could be almost anything.

Visual Studio's request to give the location of a .cpp-file pops up when you're in debug mode to tell you the exact line the error occurred. Most times, that's not really needed. You can try that later when you're into C++.
I guess, the thread you mentioned isn't about your problem because Tutorial 0 isn't about WinForms.

Beauty

23-01-2009 20:15:16

Try out Microsoft Visual C++ 2008 SP1 Redistributable Package (vcredist_x86.exe)
www.microsoft.com/downloads/details.asp ... layLang=en

Maybe this is the reason. I think the linked vcredist_x86.exe on is too old.

Also install DirectX Redist (November 2008)
http://www.microsoft.com/downloads/deta ... layLang=en

lakersforce

23-01-2009 20:42:39

I have installed the new vcredist_x86.exe suggested, but the exceptions are still the same.

When I build it with an "Any CPU" option I get the exception shown in anycpu.jpg.

I followed directions from this thread http://www.ogre3d.org/addonforums/viewtopic.php?p=23666#23666 and tried to make an "x86" specific release. This time I get a different exception, as shown in x86.jpg.

The exceptions are the same on both "debug" and "release" builds.

I'm running on Vista and VS2008 Team System.

lakersforce

23-01-2009 20:50:58

Let me post my edited *.cfg files too (are they supposed to have / instead of \ ?):

resources.cfg
# Resource locations to be added to the 'boostrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=C:/MogreSDK/Media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
FileSystem=C:/MogreSDK/Media
FileSystem=C:/MogreSDK/Media/fonts
FileSystem=C:/MogreSDK/Media/materials/programs
FileSystem=C:/MogreSDK/Media/materials/scripts
FileSystem=C:/MogreSDK/Media/materials/textures
FileSystem=C:/MogreSDK/Media/models
FileSystem=C:/MogreSDK/Media/overlays
FileSystem=C:/MogreSDK/Media/particle
FileSystem=C:/MogreSDK/Media/gui
FileSystem=C:/MogreSDK/Media/DeferredShadingMedia
Zip=C:/MogreSDK/Media/packs/cubemap.zip
Zip=C:/MogreSDK/Media/packs/cubemapsJS.zip
Zip=C:/MogreSDK/Media/packs/dragon.zip
Zip=C:/MogreSDK/Media/packs/fresneldemo.zip
Zip=C:/MogreSDK/Media/packs/ogretestmap.zip
Zip=C:/MogreSDK/Media/packs/skybox.zip


plugins.cfg
# Defines plugins to load

# Define plugin folder
PluginFolder=C:/MogreSDK

# Define plugins
Plugin=RenderSystem_Direct3D9_d
Plugin=RenderSystem_GL_d
Plugin=Plugin_ParticleFX_D
Plugin=Plugin_BSPSceneManager_d
Plugin=Plugin_OctreeSceneManager_d
Plugin=Plugin_CgProgramManager_d

smiley80

23-01-2009 21:04:24

Are the config files in the build folder?
Do you use the correct plugins.cfg? The one where the filenames have a '_d' suffix is for the debug libraries.
Are the paths in the cfg files correct?

are they supposed to have / instead of \ ?
yes

raygeee

23-01-2009 21:13:09

About the direct3d-error: try commenting out the direct3d plugin and use opengl. What's it then?

Questions:
First, the most important one: Which output folder are you using? The Mogre/bin-folder or a seperate one? If you're using the Mogre/bin-folder it could have been that you accidently overwrote some release dlls with debug ones or vice versa (happened to me the first time). This can only be resolved by reinstalling MogreSDK.

Second: Are you always pointing to the correct dlls?
In Debug mode you should reference the ones with *_d.dll, in Release mode the ones without. The plugins.cfg should reflect that!
Also if you're using a seperate output folder, check the existence of the original Ogre files - like OgreMain.dll, OIS.dll. They should exist in your output folder! Same here, _d in Debug and without in Release.

One of those tries should give you/us more information.

lakersforce

23-01-2009 22:27:07

First the log:
23:09:28: Creating resource group General
23:09:28: Creating resource group Internal
23:09:28: Creating resource group Autodetect
23:09:28: SceneManagerFactory for type 'DefaultSceneManager' registered.
23:09:28: Registering ResourceManager for type Material
23:09:28: Registering ResourceManager for type Mesh
23:09:28: Registering ResourceManager for type Skeleton
23:09:28: MovableObjectFactory for type 'ParticleSystem' registered.
23:09:28: OverlayElementFactory for type Panel registered.
23:09:28: OverlayElementFactory for type BorderPanel registered.
23:09:28: OverlayElementFactory for type TextArea registered.
23:09:28: Registering ResourceManager for type Font
23:09:28: ArchiveFactory for archive type FileSystem registered.
23:09:28: ArchiveFactory for archive type Zip registered.
23:09:28: FreeImage version: 3.10.0
23:09:28: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
23:09:28: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
23:09:28: DDS codec registering
23:09:28: Registering ResourceManager for type HighLevelGpuProgram
23:09:28: Registering ResourceManager for type Compositor
23:09:28: MovableObjectFactory for type 'Entity' registered.
23:09:28: MovableObjectFactory for type 'Light' registered.
23:09:28: MovableObjectFactory for type 'BillboardSet' registered.
23:09:28: MovableObjectFactory for type 'ManualObject' registered.
23:09:28: MovableObjectFactory for type 'BillboardChain' registered.
23:09:28: MovableObjectFactory for type 'RibbonTrail' registered.
23:09:28: Loading library C:/MogreSDK\RenderSystem_Direct3D9_d
23:09:28: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library C:/MogreSDK\RenderSystem_Direct3D9_d. System Error: Det angivne modul blev ikke fundet.

in DynLib::load at ..\src\OgreDynLib.cpp (line 80)


I have the correct configs in the Debug and Release folder. The config files in the Mogre directory (C:\MogreSDK) has not been changed, but the ones copied to my build folder has (and they point at C:/MogreSDK). I have tried to change the location to which they point to C:/MogreSDK/Lib or C:/MogreSDK/bin/debug (and release). When changed to C:/MogreSDK/bin/debug (and release) I did not get the usual error (the line 80 error), but got a new error. See the attached screenshot (AnyDebugPluginChanged.jpg)

I build the project in Visual Studios default folder. I have tried to copy the entire content from my Mogre Debug and Release folders to my builds Debug and Release folder.

I tried to comment out the DirectX line. Almost the same error; see the attached screenshot (AnyDebugNoDX.jpg)

Below I have attached my solution (MogreTut0.zip), so a gently soul could look it over to reassure that everything is in order (or not...I hope not :( )(for the sake of bandwith I have not yet been build (which means that Mogre.dll and MogreFramework.dll has not yet been imported into the project and they might show up as broken when you open the solution. The references have been imported from C:\MogreSDK\bin\Release)).

EDIT: The text in a foreign language in the "line 80" exception translates to: "System Error: The specified module could not be found".

lakersforce

23-01-2009 23:41:53

Hmm...

I copied my *.exe files from my build library to C:\MogreSDK\bin\(Debug and Realease) folders (which contains the unaltered *.cfg files) and everything runs fine. So it really was a case of the paths in the cfg files being wrong. I still do not see where the error is when I look at them though.

Thanks all, for you help!

(And sorry for "yet-another-thread" about this exception :oops: )

EDIT: This appears to be a Visual Studio specific problem. I told the compiler to save the exe file to the Debug and Release folders inside the MogreSDK folder and then run it. When I do this I still get the "line 100" exception. But if I run the exe files outside of Visual Studio (i.e. in Windows Explorer) everything is fine (and I swear I have installed everything that is required). Wierd!

Beauty

24-01-2009 00:12:43

23:09:28: Loading library C:/MogreSDK\RenderSystem_Direct3D9_d
23:09:28: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library C:/MogreSDK\RenderSystem_Direct3D9_d. System Error: Det angivne modul blev ikke fundet.

The tutorial explains only using the release dll version.
As I see in the logfile the debug version was loaded.
If you want to use the debug versions there are other depencies.
If I remember right e.g. the DirectX SDK and Visual Studio SP1 (instead of vcredist.exe).
For the first there is no need for the debug versions.

Fine that it is running now at your computer :D

lakersforce

24-01-2009 00:33:17

23:09:28: Loading library C:/MogreSDK\RenderSystem_Direct3D9_d
23:09:28: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library C:/MogreSDK\RenderSystem_Direct3D9_d. System Error: Det angivne modul blev ikke fundet.

The tutorial explains only using the release dll version.
As I see in the logfile the debug version was loaded.
If you want to use the debug versions there are other depencies.
If I remember right e.g. the DirectX SDK and Visual Studio SP1 (instead of vcredist.exe).
For the first there is no need for the debug versions.

Fine that it is running now at your computer :D


Might be, but the problem was the same in both Debug and release builds.

I updated the Wiki on Tut0 to reflect what I've learned.

Beauty

24-01-2009 16:17:10

Might be, but the problem was the same in both Debug and release builds.

Creating a Project
...
Now that we have a project created, we need to add references to it. Right click on "References" in the project, and select "Add Reference". Click on the "Browse" tab, and change the directory to "C:\MogreSDK\bin\release". Select both Mogre.dll and MogreFramework.dll and click "OK".

Do you remember if you add the reference to the release dll files for shure?
Is it possible you choosed the debug files?

I updated the Wiki on Tut0 to reflect what I've learned.
That's great!

lakersforce

26-01-2009 08:55:35


Do you remember if you add the reference to the release dll files for shure?


Absolutely!


Is it possible you choosed the debug files?


No! Not as default. Of course I tried it.