Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The joys of relative and absolute paths
#1
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.


Attached Files
.tar   cc2.tar (Size: 30 KB / Downloads: 1)
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)