Forums
The joys of relative and absolute paths - Printable Version

+- Forums (http://www.scratchpadgames.net/forums)
+-- Forum: MagPi articles (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=7)
+--- Forum: General Chat (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=8)
+--- Thread: The joys of relative and absolute paths (/showthread.php?tid=128)



The joys of relative and absolute paths - Brian Beuken - 08-15-2018

Its been brought to my notice that some of the earlier lessons, which expected Rasbian Jessie libs, have been hard to upgrade, to Stretch, since its not clear how to add the new libs.
Code::Blocks has 2 basic ways of searching for libs.

You can define the full path and name of the libĀ 
like this
../../../../opt/vc/lib/libEGL_static.a

but what do those ../ symbols mean... Thats an indication of a relative path, in other words the linker will look at your current bin directory, and step back into the dir structure each time it sees a ../
Generally thats a good idea to do, if you are using a system with libs that you make, but I must admit it was poor choice on my part to include that on tutorials for on board libs.
Its much more sensible to use an absolute path

/opt/vc/lib/libEGL_static.a


The reason being that Raspbians file structure is consistent, so you can indeed go to the root then opt, then vc etc

The other ways is just to name the libs, and ensure that you have the linker search directories set to the correct dirs, in this case
/opt/vc/lib
and
/usr/lib


I've attached a more Stretch friendly version of Lesson 2 which is the 1st graphic project that needs libs, if you have problems please use this.