Sign in to follow this  
RevBlueJeans

[RESOLVED] Wrapping Irrlicht (unresolved external symbol)

Recommended Posts

RevBlueJeans    122
I am attempting to wrap portions of Irrlicht that will be used in my game. However I've come across a problem. Here is the VS2010 error that I am receiving:

Error 1 error LNK2019: unresolved external symbol __imp__createDevice referenced in function "public: void __thiscall irrInterfacer::initializeIrrlicht(enum irr::video::E_DRIVER_TYPE,wchar_t const *,class irr::core::dimension2d<unsigned int> const &,bool,bool,bool)" (?initializeIrrlicht@irrInterfacer@@QAEXW4E_DRIVER_TYPE@video@irr@@PB_WABV?$dimension2d@I@core@4@_N33@Z) C:\Users\Steven\Documents\Visual Studio 2010\Projects\Novus\Novus\irrInterfacer.obj Novus

Here is my code for irrInterfacer::initializeIrrlicht()


//From irrInterfacer.h
void initializeIrrlicht(irr::video::E_DRIVER_TYPE driverType, const wchar_t* windowCaption, const irr::core::dimension2d<irr::u32>& windowSize, bool FS, bool SB, bool VS);

//From irrInterfacer.cpp
void irrInterfacer::initializeIrrlicht(irr::video::E_DRIVER_TYPE driverType, const wchar_t* windowCaption, const irr::core::dimension2d<irr::u32>& windowSize, bool FS, bool SB, bool VS)
{
//Create Device
device = irr::createDevice(driverType, windowSize, 32, FS, SB, VS, 0);
//Set Window Caption
device->setWindowCaption(windowCaption);
//Load Driver
driver = device->getVideoDriver();
//Get Scene Manager
smgr = device->getSceneManager();
//Get GUIEnvironment
guienv = device->getGUIEnvironment();
}




Any help would be greatly appreciated!

Thanks,
-Rev

[Edited by - RevBlueJeans on October 17, 2010 12:26:29 AM]

Share this post


Link to post
Share on other sites
RevBlueJeans    122
Thanks adam! That worked. I created this project a couple days ago and I thought I had already linked the library. It compiles now with no errors. However, I am still having a problem. When I try to run the .exe it crashes. I used the debugger in VS and narrowed it down and found out that it's crashing on a particular line. It's crashing when I try to create and initialize my irrInterfacer interfacer object. I will post the code of from my irrInterfacer.h, irrInterfacer.cpp and main.cpp that pertains to the function. If you see what I'm doing wrong please correct me. I'm no expert on pointers and objects so I could be approaching this from a completely wrong direction!

main.cpp (This is where the program is hanging up at)

irrInterfacer *interfacer;
interfacer->initializeIrrlicht(irr::video::EDT_DIRECT3D9, L"Novus Test One",
irr::core::dimension2d<irr::u32>(800, 600), false, false, false);



irrInterfacer.h

void initializeIrrlicht(irr::video::E_DRIVER_TYPE driverType, const wchar_t* windowCaption, const irr::core::dimension2d<irr::u32>& windowSize, bool FS,
bool SB, bool VS);



irrInterfacer.cpp

void irrInterfacer::initializeIrrlicht(irr::video::E_DRIVER_TYPE driverType, const wchar_t* windowCaption, const irr::core::dimension2d<irr::u32>& windowSize, bool FS, bool SB, bool VS)
{
//Create Device
device = irr::createDevice(driverType, windowSize, 32, FS, SB, VS, 0);
//Set Window Caption
device->setWindowCaption(windowCaption);
//Load Driver
driver = device->getVideoDriver();
//Get Scene Manager
smgr = device->getSceneManager();
//Get GUIEnvironment
guienv = device->getGUIEnvironment();
}




Thanks!

Share this post


Link to post
Share on other sites
adam4813    729
This one is easy and goes back to basic c++.

irrInterfacer *interfacer; declares a pointer to an irrInterfacer. However that doesn't instantiate it or create it. So the next line you are telling it to run a function on memory the computer owns. You need to:
a) use irrInterfacer interfacer; to create an instance or
b) use irrInterfacer* interfacer = new irrInterfacer(); to create a new instance, and then neat the end of your could use delete interface;

Share this post


Link to post
Share on other sites
adam4813    729
Glad to hear it helped. I myself am working with irrlicht right now to create a game. I haven't created a wrapper more so a general game class that calls all my irrlicht engine stuff. This way I can leave my main.cpp and main loop clear and clutter free.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this