Strange Linking Error!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Guest

Strange Linking Error!

Post by Guest »

When I try to compile my project, after adding some Irrlicht code into my engine:

Code: Select all

//CIrrlichtManager.cpp
//Handles initiating irrlicht device, driver, smgr, gui and camera

//Include its header
#include "CIrrlichtManager.h"

void CIrrlichtManager::initIrrlicht()
{
//Create Irrlicht device
IrrlichtDevice *device =		createDevice(EDT_OPENGL, dimension2d<s32>(800,600), 16, false, false, 0);

//Define video driver, GUI environment and scene manager
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();

//Create our FPS camera
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 30, 50, -1);
}
I get this linker error (IDE: Microsoft Visual C++ .NET 2003)

CIrrlichtManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::EDriverType,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,class irr::IEventReceiver *,unsigned short const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4EDriverType@video@1@ABV?$dimension2d@H@core@1@I_N2PAVIEventReceiver@1@PBG@Z) referenced in function "private: void __thiscall CIrrlichtManager::initIrrlicht(void)" (?initIrrlicht@CIrrlichtManager@@AAEXXZ)
Debug/OninWars.exe : fatal error LNK1120: 1 unresolved externals

Thanks.
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

All the advice I can offer is to check that you have referenced the directories for the "irrlicht.h" and the "Irrlicht.lib" files and you have included them in your code.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Guest

Post by Guest »

...and the irrlicht.dll in the debug folder.
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

You linked irrlich library, didn't you ? ;)
Look 'hello word' tutorial on how to compile project using irrlicht with MSVC.
Tomasz Nowakowski
Openoko - www.openoko.pl
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Anonymous wrote:...and the irrlicht.dll in the debug folder.
And what if someone is making a release version ? :twisted:
Tomasz Nowakowski
Openoko - www.openoko.pl
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

With VC, it's the Release folder by default.
Crud, how do I do this again?
Guest

Post by Guest »

hi
I have the same problem.
I have made a link in the Libary and Include(Sorry for my bad english im german)
Guest

Post by Guest »

Sorry I forgoth.
if I open open zhe downloaded on and compile it. I get a message that he couldnt find dll
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

@saigumi:
Yes i know :) I just wanted to make a point, that Guest's answer was "this special case" only.
Tomasz Nowakowski
Openoko - www.openoko.pl
Guest

Post by Guest »

In the hello world tutorial it says "Select the Menu Extras -> Options." This is not in Visual C++ .NET 2003, what is the equivalent of this?
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Anonymous wrote:In the hello world tutorial it says "Select the Menu Extras -> Options." This is not in Visual C++ .NET 2003, what is the equivalent of this?
Had some problems with this too. Here you can find it:

Right-click on your project -> Properties ->

C/C++ -> Includes: General (Additional Include Directories)
Linker -> Libs: General (Additional Library Directories)
Guest

Post by Guest »

That's what I thought...

I already had both of those in there..

in my libs:
"C:\Documents and Settings\Owner\Desktop\3D\irrlicht-0.6\irrlicht-0.6\lib\VisualStudio

in my include:
C:\Documents and Settings\Owner\Desktop\3D\irrlicht-0.6\irrlicht-0.6\include

and I still get the error :\
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Do you have the dll in the main directory??

For instance, if you have a directory "C:\helloWorld" and you have the model and textures inside "C:\helloWorld" and your .exe is in "C:\helloWorld\Debug", when I'm using Visual C++, because I'm running it within VC++ all the files (textures AND DLL's) need to be in the "C:\helloWorld" directory and NOT the Debug.

I'm not sure if it works that way in .NET, but it might be worth a try.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Guest

Post by Guest »

Alright, I added it to both the project directory and debug, but still, I get this same error:

CIrrlichtManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::EDriverType,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,class irr::IEventReceiver *,unsigned short const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4EDriverType@video@1@ABV?$dimension2d@H@core@1@I_N2PAVIEventReceiver@1@PBG@Z) referenced in function "public: void __thiscall CIrrlichtManager::initIrrlicht(void)" (?initIrrlicht@CIrrlichtManager@@QAEXXZ)
Debug/OninWars.exe : fatal error LNK1120: 1 unresolved externals
Guest

Post by Guest »

Anonymous wrote:Alright, I added it to both the project directory and debug, but still, I get this same error:

CIrrlichtManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::EDriverType,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,class irr::IEventReceiver *,unsigned short const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4EDriverType@video@1@ABV?$dimension2d@H@core@1@I_N2PAVIEventReceiver@1@PBG@Z) referenced in function "public: void __thiscall CIrrlichtManager::initIrrlicht(void)" (?initIrrlicht@CIrrlichtManager@@QAEXXZ)
Debug/OninWars.exe : fatal error LNK1120: 1 unresolved externals
This have nothing to do with the DLL, you must link the LIB
Try this at the top ove your code:

Code: Select all

#pragma comment(lib, "Irrlicht.lib")
It tells the compiler to link the lib
if it says "cant find irrlicht.lib" or something then check if you tell your compile the directorys where the irrlicht.lib is located (i am german too :oops: :wink: )
Post Reply