How to build in your own path using linux?

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
oppositescopez
Posts: 14
Joined: Wed Sep 11, 2013 3:00 pm
Contact:

How to build in your own path using linux?

Post by oppositescopez »

using linux mint cinnamon 64 bit.
ok, so i built the tutorials. that worked. i understand you build with the make file. but to make my own outside of the "irrlicht-1.8.1" file i dont understand how to compile. i do not know how to make my own makefile x.x and ive tried to manipulate the one inside example 01 and put it in my folder but i couldnt get it >.< ...
CuteAlien
Admin
Posts: 9689
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to build in your own path using linux?

Post by CuteAlien »

You mean you want to make an own project that is in another path and uses Irrlicht? It's the same in every c/c++ library. You always need 2 things:
- Header include paths
- Linker paths.

The header include paths tell the compiler where it can find the library headers. If you work directly with makefiles you add them like: -ImyIncludePath
Note that there is _no_ space between -I and myIncludePath (as paths can start with spaces on Linux). And myIncludePath is certainly the path where the headers files are in. In case of Irrlicht that would be whereeveryouhaveIrrlicht/include

The linker paths tell the linker where it finds the library files (.a by default in your Linux build, if you ever need shared libs ask again). In makefiles they are added with: -LmyLinkerPath
In case of Irrlicht that would be in whereeveryouhaveIrrlicht/lib/Linux

And you have to link to the lib itself with: -lIrrlicht
Note that you should not use a path here (you did set that with -L) and you don't use the file-ending (.a).

In c/c++ this works basically the same on every platform, every build-system or IDE, (nearly) every library.The exact names used by different build-systems might differ slightly, but each of them will need the above information in some way.
(Exception are libs which are header-only like some boost libs which don't need linking at all. And sometimes it's a little easier when you use system libraries as those might be found by default by your IDE or compile-system. And shared libraries like .so or .dll have some further complications as you have to ensure they are also found at runtime)

Also - even on Linux you can use an IDE like Code::Blocks. It might be easier for a start than working with Makefiles as you don't have to learn the makefile syntax then (on the other hand it's not bad doing that stuff once by hand to really understand the way it works).
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
superpws
Posts: 18
Joined: Mon Mar 31, 2014 6:47 am
Contact:

Re: How to build in your own path using linux?

Post by superpws »

CuteAlien wrote:...
This should be put on wiki under title something like "Compiling your own Irrlicht project using Makefile" :)
IRC: #irrlicht on irc.freenode.net
Github: https://github.com/danyalzia
Homepage: http://danyalzia.com
Post Reply