Please Help Me.. My First Ogre3D Program.

tharshan

19-06-2007 01:08:23

Hello Friends,

i just started Ogre Today. and downloaded & installed Mogre & set it up already.

please help me to get started with my first app.

i am using Microsoft Visual C# 2005 Express(service pack installed)

Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: C# Express

Microsoft Visual C# 2005
Microsoft Visual C# 2005


i added the refrence files. (.dlls from Bin/Release folder).
and copied the cfg files from bin/release to the : "Project Folder/Bin/Release , Debug"

and i just followed the First Tutorial in Wiki..

as shown below..

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MogreFramework;
using Mogre;

namespace Test
{
static class Program
{
[STAThread]
static void Main()
{
OgreWindow win = new OgreWindow();
win.Go();
}
}
}



but there is a error !

error in >> Win.Go();

i already searched the forum & cannot get it work.

here is a screenshot of my error..
http://img362.imageshack.us/img362/661/error1nr6.jpg
Thanks a lot..

pepote

19-06-2007 14:17:02

Not only you need add references to debug or release folders. You also need put to proyect the references.

In Visual Studio's right view you can see the files and a dir named References, Open, select the dir and push left mouse button. Now click on Add Reference an click on .Net assemblies, now you can link to the OGRESDK references in debug or in release dir.

tharshan

19-06-2007 15:14:37

i think its still showing the same error...

any ideas ?

pjohnsen

19-06-2007 22:49:22

It depends a bit on your directory layout, but I'm guessing it cannot load the other DLLs which mogre depends on.

I usually set it up so that the build copies the exe to OgreSDK/bin/debug in the post build step, and then also set OgreSDK/bin/debug as the working dir for debugging the project. My post build is like this: "copy $(TargetPath) $(SolutionDir)\..\bin\$(ConfigurationName)" but obviously depends on your dir layout.

I guess as an alternative you could copy all the stuff from OgreSDK/bin/debug to your project's debug dir and then fixup the config files, but I think it will be harder to get working if you are just starting out with Mogre.

-Pelle

tharshan

19-06-2007 23:35:46

thank you.

yes. i am just started with mogre now..

sam4

05-07-2007 06:58:21

Hi,

I'm having a similiar problem with Win.Go giving out, but this time it doesn't to matter what I do it just keeps happening. Also, all of the demos seem to give a similiar error.

I'm using C#.net 2005 express. This is the exception:

Could not load file or assembly 'Mogre, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

I've tried moving all the files from the release directory to the project's debug folder, referenced the two dlls and changed the cfgs to the right directories. But it still doesn't work.

Thanks for any help :)

pjohnsen

05-07-2007 09:36:49

Do you have Service Pack 1 for VC# 2005?

You can also try using DependencyWalker (just google it) on the Mogre.dll file to see if you are missing anything else.

Hope this helps,

-Pelle

sam4

06-07-2007 01:42:01

Yes! Thankyou for your help, it was obviously the service pack it needed. It's all go now! :D

caskater4

27-07-2007 19:41:03

I'm having the same problem with the FileLoadException error. I have VC 2005 Professional with Service Pack 1 installed. I have ran the Dependency Walker on mogre.dll and it comes up with an error saying that it cannot find MSVCR80.DLL or DWMAPI.DLL. The thing is I have found MSVCR80.DLL all over my system, including the VS8 installation directory but I can't seem to find DWMAPI.DLL anywhere. Does anyone know why it isn't picking up my msvcr80.dll file and why I would be missing dwmapi.dll entirely? Is it something that only VC8 Express has?

caskater4

28-07-2007 02:07:12

This is absolutely maddening. I've wasted my entire day trying to get this damn thing to work. I've tried getting this to work on two entirely different machines now. The first machine is a XP SP2 box with VS 2k5 Pro SP1 and the second box is Vista64 with the same VS 2k5 Pro SP1. I have uninstalled and reinstalled both versions 0.2.0 and 0.2.2 countless times and am always getting an error with mogre.dll. I've uprooted the MogreFramework and attempted to start ogre with a new framework of my own and it didn't work. I also made sure to update both machines to make sure I wasn't missing anything. Restarted the computers a few times in between installations to make sure things go through and nothing. My last attempt at this was to compile mogre.dll myself but apparently the trunk has a bunch of missing files because as I looked through the project there are supposed to be a bunch of files in the include/auto directory and there is nothing in the svn trunk I checked out (revision 220). I have absolutely no problem compiling and running the ogre3d sdk in C++. I fail to see how re-installing visual studio would help at this point since i've tried this on two completely different machines. Given all that I think it's fair to say i've tried literally everything.

So please, can someone tell me what magical setup it requires to get this thing working and be detailed in how to do it? Because apparently i'm a complete moron and can't follow directions. Thanks.

pjohnsen

28-07-2007 07:22:45

As I don't have VS pro 2005 it is a bit difficult to help :(

Have you tried running the samples included with the SDK directly from bin/release or bin/debug?

The 'missing' files for building mogre are not missing, but auto-generated. Please check my thread on building with 1.4.2 for more info: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=4631.

Have you tried installing the VC redistributable for 2005 SP1: http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&displaylang=en

Can you explain more precisely what you are doing when building and running your mogre application, eg. where you put the executable?

I'll be away for the weekend, but will check back on Monday.

-Pelle

caskater4

30-07-2007 08:02:34

Thank you for responding Pelle.

I just did a fresh re-install of the 0.2.2 SDK. After successfully building the Samples sln file with 0 errors and 0 warnings I attempt to execute any of the demos and get the error:

BadImageFormatException was unhandled
Could not load file or assembly 'Mogre, Version=0.2.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.


This is the same message I have always gotten from my Vista64 box. On my XP box, I get a different Exception but with the same message body.

I have installed the VC redistributable package, a couple of times for that matter and still no difference.

As for when i'm building my applications, I have tried both methods of execution... The first being: copy all of the contents from C:\OgreSDK\bin\debug to my bin\debug and then change the resources.cfg to reflect C:/OgreSDK/ instead of ../../
Second, I have set up my solution to build to the C:/OgreSDK/bin folder or copy the build files to the appropriate OgreSDK folder. Still no luck.

I will look at the instructions for building mogre myself later.

pjohnsen

30-07-2007 08:11:29

Hmmm ... I don't know if there are any issues with 64-bit, I've only tested on 32 bit.

How do you run the sample, from inside VC#? If so please try running it standalone from bin/debug or bin/release.

If it's any help I can try sending you some of my binary compiled samples.

-Pelle

caskater4

30-07-2007 17:42:01

Ok so there definitely seems to be an incompatibility with 64-bit. I did another fresh install of 0.2.2 on my XP box and am able to run the mogre demos but only by executing them standalone. Cannot use debugger apparently, which is rather unfortunate really but can be worked around. I will try and get my code to work now and see how that goes.

As for 64-bit, my guess to why its not working is because the JIT compiles the application to the native architecture when no CPU arch is selected and if so this will have a problem with the 32-bit ogre (and other) library's. Windows does not allow any 64-bit application to execute 32-bit code within it and vice versa. It must be all or nothing. Once I get home I will try and force it to build with 32-bit and see if that helps. It would be really nice if sinbad could get a 64-bit version of ogre working though.

pjohnsen

30-07-2007 18:54:51

To get debugging working what I have done for my MOGRE projects is:

Use the debug version of mogre.dll when adding the reference, same goes for any other modules e.g. MOIS.

Setup the project with a post-build step to copy the exe to ogresdk/bin/debug, as mentioned earlier.

Set the debug properties of the project to use ogresdk/bin/debug as the working directory.

With this setup I have been able to debug my MOGRE apps.

-Pelle

caskater4

31-07-2007 01:53:54

Update: I was able to get the demo's to compile and run successfully on Vista 64-bit. In order for it to run, the build settings must be set to compile for x86 instead of Any CPU. Only then will it run on 64-bit.

Bekas

01-08-2007 14:06:59

The 64-bit issue is already on the FAQ:
http://www.ogre3d.org/wiki/index.php/Mogre_FAQ#I_get_a_System.BadImageFormatException_within_a_64-bit_enviroment.2C_what.27s_wrong_.3F

pin

02-08-2007 09:36:29

Hey Bekas nice to see you back!