C++ Development Question
Hello CentOS user. 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.
I hope someone can help my on this. Regards, Leo.
2 thoughts on - C++ Development Question
Leandro wrote:
Read the manpage on yum to start.
Do you have gcc++ installed? If not, yum install “Development tools”
(assuming you’re running CentOS 7; if you’re on 6, it’s yum groupinstall
I suppose, if you really, *really* need a 2GB text editor, you could install eclipse.
Then, understand that any package *should* install in the correct place. For some oddities, you might have to set the environment variable LD_LIBRARY_PATH.
Finally, to see what libraries or compiler tools are available, yum list lib\*, etc.
Also, check to see if you have rpmfusion and epel repos enabled.
mark
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