Reputation: 549
I am trying to build the example 01.HelloWorld" of Irrlicht using VS 2010. When I do I get the error:
LNK2019: unresolved external symbol __imp__createDevice referenced in function _main
I found a possible solution for this problem, and tried to apply some solutions in the answer, by changing int main
to int _tmain(int argc, _TCHAR* argv[])
and int _tmain()
but it didn't work.
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
#include <tchar.h>
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Upvotes: 2
Views: 2835
Reputation: 11
What fixed this for me was adding
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
Upvotes: 0
Reputation: 1854
Just on what you've provided, there are three likely solutions:
You didn't add lib/VisualStudio to your additional linker directories.
IrrLicht.dll is missing from the project directory.
The code is looking for _main()
, not main()
, and not _tmain()
. Try changing int main()
to int _main()
.
This probably won't work, but it's the best I can do working on what I've got.
Upvotes: 1