[CentOS] c++ Development question

Fri Nov 6 18:58:45 UTC 2015
John R Pierce <pierce at hogranch.com>

On 11/6/2015 10:05 AM, Leandro wrote:
> Im learning about c/c++ , so far every thing works great.
> The problem begins when I try to install a new library or a third 
> party api.
> For example now I need to install the jsoncpp implementation in my 
> centos box but I have no idea how to do it.
> I realized that my knolowge about those things is very poor.
> I would like to ask you for some documentation about libraries 
> directories layout regarding  c/c++ programing.
> Im not interested in the languaje it self but how to prepare my server 
> to succesfully compile c/c++ programas. 

DO not put anything you've built in any of the system libraries 
(/usr/lib, etc) unless you package your code as RPM for deployment.

Libraries you compile for your own use would normally be put in a lib 
directory somewhere under your own home directory, perhaps under your 
project directory, and they should be referenced in your make file.   
.a, .o libraries that are in, say, $HOME/lib, can be referenced by 
-L$HOME/lib  ...  if these are .so libraries, if you specify the path to 
your /lib/ directory in the --rpath option to ld (the gnu linker) or 
-Wl,--rpath= when you use gcc++ to link for you, then at runtime it will 
look for the .so files in that path.

if the programs you're compiling will be installed under /usr/local for 
system-wide use, then the required shared libraries should also be 
installed under /usr/local/something   and that path should be passed to 
--rpath



-- 
john r pierce, recycling bits in santa cruz