Page 1 of 1

How to build in your own path using linux?

Posted: Sat Jul 12, 2014 5:10 am
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 >.< ...

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

Posted: Sun Jul 13, 2014 11:05 am
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).

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

Posted: Sun Jul 27, 2014 8:39 am
by superpws
CuteAlien wrote:...
This should be put on wiki under title something like "Compiling your own Irrlicht project using Makefile" :)