[Solved] Building as static library

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.
Post Reply
Botyto
Posts: 2
Joined: Wed Jan 20, 2016 2:44 pm

[Solved] Building as static library

Post by Botyto »

Hello. I've been trying to write a game engine in C++, but got tired of trying to make the graphics work, so I went to Irrlicht for help.
I'm using GLFW (and I would like to keep it) and want to use the window from GLFW with Irrlicht.
I could use the DLL, but I don't really like those and also I want to port the engine to Android (at least), which makes it NOT an option.
So the problem is that I am building the library, but then when I use it the linker cries at:

Code: Select all

irr::IrrlichtDevice * device = irr::createDeviceEx(param);
LNK2019 unresolved external symbol __imp__createDeviceEx referenced in function "private: class core::error_code __thiscall video::window::init(void)" (?init@window@video@@AAE?AVerror_code@core@@XZ) .......
I'm compiling Irrlicht 1.8 using Visual Studio 2015 as a static library with the following settings for the Preprocessor (Debug config):

Code: Select all

_IRR_STATIC_LIB_
NO_IRR_COMPILE_WITH_CONSOLE_DEVICE_
NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
NO_IRR_USE_NON_SYSTEM_LIB_PNG_
NO_IRR_USE_NON_SYSTEM_ZLIB_
_CRT_SECURE_NO_DEPRECATE
WIN32
_DEBUG
_MBCS
Also I tried including the library file in the Linker properties tab, and with a #pragma comment(lib, "irrlicht.lib") It seems like the functions are indeed begin compiled, but for some reason the Linker cannot find the symbols. My opinion on the matter is that I'm not providing proper preprocessor defines. Has anyone encountered such a problem and what was your solution.
I'm sorry if there is already a solution and a topic on the matter, I really couldn't find anything in Google or here :(
Thanks in advance!
Last edited by Botyto on Wed Jan 20, 2016 6:59 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Building as static library

Post by CuteAlien »

_IRR_STATIC_LIB_ must be set in the library and in your own application as preprocessor define.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Botyto
Posts: 2
Joined: Wed Jan 20, 2016 2:44 pm

Re: Building as static library

Post by Botyto »

Excellent. Thank you very much !!!
kormoran
Posts: 47
Joined: Mon Dec 28, 2015 4:50 pm
Location: Tolentino

Re: [Solved] Building as static library

Post by kormoran »

Worth noting that Irrlicht docs completely miss this detail...

that secret was revealed in the comments into IrrCompileConfig.h, line 680-681 ;-)
Post Reply