Do I need irrlicht.lib file?

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
Pythy Python
Posts: 30
Joined: Sun Mar 29, 2015 1:31 am

Do I need irrlicht.lib file?

Post by Pythy Python »

I just found that there was ilb folder inside irrlicht folder. Since I'm using Windows with MinGW, I entered MinGW gcc folder. There was a lib file for Linux but not for Windows.

So, Do I only need Irrlicht.dll file which is inside of bin folder? or do I need lib files too? if so, where do I get lib files for Windows g++?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Do I need irrlicht.lib file?

Post by CuteAlien »

I think mingw supports direct linking against the dll (https://access.redhat.com/documentation ... win32.html)

But depending on the MinGW version used you still have to recompile Irrlicht as there have been some incompatiblities between different gcc versions. To do that select the Irrlicht.cbp project file in the source/Irrlicht folder and select as target "Win32 - Release - accurate math - dll" (works probably also with 64-bit mingw systems... I hope).
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
Pythy Python
Posts: 30
Joined: Sun Mar 29, 2015 1:31 am

Re: Do I need irrlicht.lib file?

Post by Pythy Python »

Umm...I don't understand "Win32 - release - accurate" part. I'm using g++ with command prompt, not Visual Studio...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Do I need irrlicht.lib file?

Post by CuteAlien »

Ah ok, that was about code::blocks as most MinGW users work with that. For command line there should be a Makefile (call with "make win32").
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
Pythy Python
Posts: 30
Joined: Sun Mar 29, 2015 1:31 am

Re: Do I need irrlicht.lib file?

Post by Pythy Python »

I'm sorry to ask another question but do I need lib file? it seems like my exe runs fine without linking libirrlicht.a...(sorry I don't understand what lib and dll does...)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Do I need irrlicht.lib file?

Post by CuteAlien »

It's a little complicated on Windows as it depends on the compiler. Short answer - no - you don't need it in your case.

Long answer:
There is static and dynamic linking for a library. Static means the code of the library will be in your exectuable in the end (but only those parts of the library which your application needs). Dynamic linking means that your application only get's some information that library code exists but the real library code stays in a dll. That dll is then automatically loaded at program start by your exe (or can be loaded manually, but that is another topic and mainly useful when you program a plugin system). Which means the dll has to be delivered together with your application exe (on Windows the dll's are often put beside the .exe file).

By default Irrlicht links dynamically (with a dll) on Windows and static on Linux.

To link statically you need the .lib file on Windows (and an .a file on Linux). You also have to set a defined called _IRR_STATIC_LIB_ in your application when doing that.

To link dynamically you need a .dll file on Windows and a .so file on Linux. And sometimes you also need a stub .lib file on Windows. That's a very small .lib file which only contains information needed for linking and not the full library. You can use that with g++, but you don't have to as the gnu linker can get the same information directly from the dll. I think you must use it when you work with VisualStudio. Note that the .stub lib file for dynamic linking has the same name as a real .lib file for static linking - it's just smaller.
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
Post Reply