Page 1 of 1

Problems with TutorialApplication and Azathoth

Posted: Fri Feb 11, 2005 11:46 am
by Jeff
I'm getting a funny error when I try compile TutorialApplication.cpp for the first time:

Code: Select all

Compiling...
TutorialApplication.cpp
c:\ogretutorials\ogretutorials\tutorial3\tutorialapplication.cpp(12) : error C2084: function '__thiscall TutorialApplication::TutorialApplication(void)' already has a body
c:\ogretutorials\ogretutorials\tutorial3\tutorialapplication.cpp(21) : error C2084: function 'void __thiscall TutorialApplication::createScene(void)' already has a body
Error executing cl.exe.
The constructor, destructor and method bodies are completely empty and this is what my class definition looks like:

Code: Select all

#include "ExampleApplication.h"
class TutorialApplication : public ExampleApplication
{
public:
    TutorialApplication()
    {
    }
    virtual ~TutorialApplication();
protected:
    void createScene()
    {
    }
};
Any help would be appreciated

Posted: Fri Feb 11, 2005 12:49 pm
by ibrown
I assume your class definition is in a header file (i.e. your snippet comes from a header file). There you both declare the constructor and also define it in an inline manner.

The compiler is telling you that you also have it defined in the cpp file. So, you have 2 definitions. One of them needs to go.

Either change your header file to look like this:

Code: Select all

class TutorialApplication : public ExampleApplication 
{ 
public: 
    TutorialApplication();
    virtual ~TutorialApplication(); 
protected: 
    void createScene() ;
};
or delete the implementation in the cpp file (which I guess it at line 12 of TutorialApplication.cpp by looking at your error). It probably looks like:

Code: Select all

TutorialApplication::TutorialApplication()
{

}
Of course, if there is any actual code in the .cpp implementation, you want to make the change to the header file and get rid of the inline implementation there.

Ian

Posted: Fri Feb 11, 2005 2:27 pm
by Jeff
Thanks, I've not tried it out but this makes sense and I know it'll work

I'd have never had thought about it otherwise - what an amateur mistake :oops:

Posted: Fri Feb 11, 2005 6:12 pm
by Jeff
Ok, went home and sorted my header file. Got another error because it couldn't find Ogre.lib - so changed the linking.

Thought it would finally be it and BAM!

Code: Select all

TutorialApplication.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void * __thiscall Ogre::MemoryManager::op_new_sc(unsigned int,unsigned int)" (__imp_?op_new_sc@MemoryManager@Ogre@@AAEPAXII@Z)
WinMain.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void * __thiscall Ogre::MemoryManager::op_new_sc(unsigned int,unsigned int)" (__imp_?op_new_sc@MemoryManager@Ogre@@AAEPAXII@Z)
TutorialApplication.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: unsigned int __thiscall Ogre::MemoryManager::_getProcessID(void)" (__imp_?_getProcessID@MemoryManager@Ogre@@AAEIXZ)
WinMain.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: unsigned int __thiscall Ogre::MemoryManager::_getProcessID(void)" (__imp_?_getProcessID@MemoryManager@Ogre@@AAEIXZ)
TutorialApplication.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void __thiscall Ogre::MemoryManager::op_del_sc(void *,unsigned int)" (__imp_?op_del_sc@MemoryManager@Ogre@@AAEXPAXI@Z)
WinMain.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void __thiscall Ogre::MemoryManager::op_del_sc(void *,unsigned int)" (__imp_?op_del_sc@MemoryManager@Ogre@@AAEXPAXI@Z)
TutorialApplication.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall Ogre::MemoryManager::setOwner(char const *,unsigned int,char const *)" (__imp_?setOwner@MemoryManager@Ogre@@QAEXPBDI0@Z)
../bin/Debug/Tutorial3.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
I almost cried, why am I finding it so hard to set up Ogre?? I have installed STLport, got azathoth and new dependencies all put in place, and downloaded the newest service pack for VC 6.0 not to mention the newest DX SDK...

What's up with my program this time, any suggestions? I haven't changed the code. So what's up with that?

Posted: Fri Feb 11, 2005 6:43 pm
by sinbad
Looks like you're doing a debug build and are linking to OgreMain.lib instead of OgreMain_d.lib.

Posted: Fri Feb 11, 2005 10:24 pm
by Jeff
Thanks sinbad

Looks like my worries are almost over... I can compile and build now with tho problems, but I get this error when I try to run:

Image

I really don't want this to become one of those threads that continues forever - trust me when I say I've been able to deal with some intermediatory linking errors all on my own...

Let me know if you cant read it - I made it smaller for your benefit

Posted: Fri Feb 11, 2005 10:36 pm
by sinbad
Looks like you didn't perform a 'batch build' therefore the GL system hasn't been built?

Posted: Sat Feb 12, 2005 1:11 am
by Jeff
If you're referring to the batch build of ogre.dsw I'm pretty sure I did... I wouldn't have been able to get this far otherwise.

It's pretty late here now so I'll try rebuilding the projects tomorrow and let you know how I get on

Posted: Sat Feb 12, 2005 2:40 pm
by ibrown
Jeff,
The first thing that I do when I get a new version of Ogre is to do the batch build (both debug and release) and then run some of the sample programs. If the the samples run (I usually just run the water sample because I like that one :)) then you know that the system is compiled okay.
Then, if the tutorials or you own programs don't run then you know it is an issue with your code and not somthing missing from the Ogre build process.

Can you run the samples? If you can, and you still cannot run your program then you probably just need to adjust the config file (resources.cfg IIRC) so that Ogre knows where to find the module DLLs.

Ian

Posted: Sun Feb 13, 2005 12:05 am
by Jeff
Thanks Ian, I did think it was strange that the demos worked - I had indeed done a batch build as I was following the tutorial to the letter...

Maybe I've missed some dlls.

P.S. Yeah, the water demo is one of the best - alongside the smoke... :)

EDIT: Yup was the dlls - never have I been so happy to see a black screen (with FPS and "ogre" of course :P)