Compilation d'une scène Ogre avec c++

sk3lling Messages postés 1 Date d'inscription jeudi 24 avril 2008 Statut Membre Dernière intervention 16 juin 2008 - 16 juin 2008 à 23:34
cptpingu Messages postés 3837 Date d'inscription dimanche 12 décembre 2004 Statut Modérateur Dernière intervention 28 mars 2023 - 19 juin 2008 à 17:29
Bonjour tout le monde, je veux créer une scène avec Ogre. Lorsque je l'ai compile tout marche c'est quand j'arrive pour le démarrer (Play). Il m'apparaît six erreurs. Comment je fais pour les corrigers ? Merci de votre aide
J'ai trois fichiers du nom de :

Tutoriel1.cpp:

#include

<Ogre.h>#if

OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define

WIN32_LEAN_AND_MEAN
#include

"windows.h"#endif

#ifdef

__cplusplus
extern

"C" {
#endif

#if

OGRE_PLATFORM == OGRE_PLATFORM_WIN32INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )

#else

int main(int argc, char *argv[])

#endif

{

// Create application object

//Tutoriel1App app;

try {

//app.go();}

catch( Ogre::Exception& e ) {
#if

OGRE_PLATFORM == OGRE_PLATFORM_WIN32MessageBox( NULL, e.getFullDescription().c_str(),

"An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else

std::cerr << "An exception has occured: " <<

e.getFullDescription().c_str() << std::endl;

#endif

}

return 0;}

#ifdef

__cplusplus}

#endif

Le fichier Tutoriel1App.h:

#pragma

once#include

"ExampleApplication.h"#include

<ogre.h>#include

<windows.h>using

namespace std;

void

createScene(void);

class

Tutoriel1App : public ExampleApplication{

public

:Tutoriel1App(

void);~Tutoriel1App(

void);};

Fichier Tutoriel1App.cpp:

#include

"stdafx.h"#include

<Ogre.h>#include

"ExampleApplication.h"#include

"..\include\Tutoriel1App.h"#include

<windows.h>using

namespace std; 

 

 

Tutoriel1App::Tutoriel1App(

void){

mSceneMgr->setAmbientLight(ColourValue(1.0f,1.0f,1.0f));

Entity* ent1=mSceneMgr->createEntity(

"Robot 1",
"robot.mesh");SceneNode* node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode(

"Noeud Robot 1");node1->attachObject(ent1);

}

Tutoriel1App::~Tutoriel1App(

void){

}

Voici mes Erreurs:

tutoriel1.obj : error LNK2005: _WinMain@16 already defined in Ogre.obj

Tutoriel1App.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class OIS::InputManager * __cdecl OIS::InputManager::createInputSystem(class std::multimap<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > &)" (__imp_?createInputSystem@InputManager@OIS@@SAPAV12@AAV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@@Z) referenced in function "public: __thiscall ExampleFrameListener::ExampleFrameListener(class Ogre::RenderWindow *,class Ogre::Camera *,bool,bool,bool)" (??0ExampleFrameListener@@QAE@PAVRenderWindow@Ogre@@PAVCamera@2@_N22@Z)

Tutoriel1App.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct OIS::MouseState const & __thiscall OIS::Mouse::getMouseState(void)const " (__imp_?getMouseState@Mouse@OIS@@QBEABUMouseState@2@XZ) referenced in function "public: virtual void __thiscall ExampleFrameListener::windowResized(class Ogre::RenderWindow *)" (?windowResized@ExampleFrameListener@@UAEXPAVRenderWindow@Ogre@@@Z)

Tutoriel1App.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl OIS::InputManager::destroyInputSystem(class OIS::InputManager *)" (__imp_?destroyInputSystem@InputManager@OIS@@SAXPAV12@@Z) referenced in function "public: virtual void __thiscall ExampleFrameListener::windowClosed(class Ogre::RenderWindow *)" (?windowClosed@ExampleFrameListener@@UAEXPAVRenderWindow@Ogre@@@Z)

Tutoriel1App.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall OIS::MouseState::buttonDown(enum OIS::MouseButtonID)const " (__imp_?buttonDown@MouseState@OIS@@QBE_NW4MouseButtonID@2@@Z) referenced in function "public: bool __thiscall ExampleFrameListener::processUnbufferedMouseInput(struct Ogre::FrameEvent const &)" (?processUnbufferedMouseInput@ExampleFrameListener@@QAE_NABUFrameEvent@Ogre@@@Z)

C:\Documents and Settings\lsd\Mes documents\Visual Studio 2008\Projects\Ogre\Debug\Ogre.exe : fatal error LNK1120: 4 unresolved externals

Build log was saved at "file://c:\Documents and Settings\lsd\Mes documents\Visual Studio 2008\Projects\Ogre\Ogre\Debug\BuildLog.htm"

Ogre - 6 error(s), 0 warning(s)

======== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

1 réponse

cptpingu Messages postés 3837 Date d'inscription dimanche 12 décembre 2004 Statut Modérateur Dernière intervention 28 mars 2023 123
19 juin 2008 à 17:29
Il n'y a pas d'erreur dans l'exemple donnée. C'est une erreur de linkage. Il te manque des bibliothèques, ou celles-ci sont mal renseignées dans les options de ton compilateur. Essaies de te procurer le plugin Ogre pour Visual Studio, c'est très pratique.
Voici un lien, il date, la démarche a un peu changé, mais il te permettra quand même de faire ce que tu souhaites:
http://bauland.developpez.com/tutoriel/ogre/install/
0
Rejoignez-nous