8
« on: December 15, 2011, 10:26:21 pm »
Hello, I'm currently using SFML to detect user input, it gives a system error that goes something like this
The program can't start because sfml-window-d.dll is missing from your computer. Try reinstalling the program to fix this problem.
Currently, I have a folder named "SFML" that contains the include and library files that I need. Here is the setup of my computer
Additional Include Directories:
$(OGRE_HOME)\include;$(OGRE_HOME)\include\OIS;$(OGRE_HOME)\include\OGRE;$(OGRE_HOME)\Samples\Common\include;$(OGRE_HOME)\boost_1_44;./SFML
Additional Library Directories:
$(OGRE_HOME)\lib\$(Configuration);$(OGRE_HOME)\boost_1_44\lib;./SFML/lib;
Additional Dependencies
OgreMain.lib;OIS.lib;sfml-main.lib;sfml-system-s-d.lib;sfml-window-d.lib;%(AdditionalDependencies)
Some of the files inside SFML (not all)
:
System.hpp
Window.hpp
lib (folder)
the files inside SFML\lib
:
sfml-main.lib
sfml-system-s-d.dll
sfml-system-s-d.lib
sfml-window-d.dll
sfml-window-d.lib
And finally (if you need it) my code (my ogre code is based on the ogre3d tutorial, and the cpp file in focus now is my tutorialapplication.cpp file (it's where most of the code i insert takes place. it's also where i put the sfml code)
/*
-----------------------------------------------------------------------------
Filename: TutorialApplication.cpp
-----------------------------------------------------------------------------
This source file is part of the
___ __ __ _ _ _
/___\__ _ _ __ ___ / / /\ \ (_) | _(_)
// // _` | '__/ _ \ \ \/ \/ / | |/ / |
/ \_// (_| | | | __/ \ /\ /| | <| |
\___/ \__, |_| \___| \/ \/ |_|_|\_\_|
|___/
Tutorial Framework
http://www.ogre3d.org/tikiwiki/
-----------------------------------------------------------------------------
*/
#include "TutorialApplication.h"
//add SFML
#include<SFML\System.hpp>
#include<SFML\Window.hpp>
#include<SFML\Graphics.hpp>
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
TutorialApplication::TutorialApplication(void)
{
}
TutorialApplication::~TutorialApplication(void)
{
}
//-------------------------------------------------------------------------------------
void TutorialApplication::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0,0,0));
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja","ninja.mesh");
entNinja->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);
//the plane
Ogre::Plane plane(Ogre::Vector3::UNIT_Y,0);
Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity","ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
//materials for the floor
entGround->setMaterialName("Examples/Rockwall");
entGround->setCastShadows(false);
//lights
Ogre::Light* pointLight = mSceneMgr->createLight("pointLight");
pointLight->setType(Ogre::Light::LT_POINT);
pointLight->setPosition(Ogre::Vector3(0,150,250));
pointLight->setDiffuseColour(1.0,0.0,0.0);
pointLight->setSpecularColour(1.0,0.0,0.0);
//directional light
Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(.25,0.25,0.0);
directionalLight->setSpecularColour(.25,0.25,0.0);
directionalLight->setDirection(Ogre::Vector3(0,-1,1));
//spotlight
Ogre::Light* spotLight = mSceneMgr->createLight("spotLight");
spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
spotLight->setDiffuseColour(0, 0, 1.0);
spotLight->setSpecularColour(0, 0, 1.0);
spotLight->setDirection(-1, -1, 0);
spotLight->setPosition(Ogre::Vector3(300, 300, 0));
spotLight->setSpotlightRange(Ogre::Degree(35),Ogre::Degree(50));
//SFML STUFF
sf::Event Event;
while(App.IsOpened())
{
while (App.GetEvent(Event))
{
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::U))
mSceneMgr->getRootSceneNode()->translate(Ogre::Vector3(10,0,0));
}
}
}
void TutorialApplication::createCamera(void)
{
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Ogre::Vector3(0,10,500));
mCamera->lookAt(Ogre::Vector3(0,0,0));
mCamera->setNearClipDistance(5);
mCameraMan = new OgreBites::SdkCameraMan(mCamera);
}
void TutorialApplication::createViewports(void)
{
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth())/Ogre::Real(vp->getActualHeight()));
}
#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_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// Create application object
TutorialApplication app;
try
{
app.go();
} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( 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
So where did I go wrong? where should I put the dll file anyway? Cheers
PS:
My Project is set under "Release" when being built and run, there are no other errors that are pointed out by visual studio other than the missing dll