davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

is there a standard path to #include libs system-wide?

Tue Dec 22, 2015 4:29 pm

hello,

is there a standard path to put proprietary libs for #include system-wide?
e.g., for
#include <custom_xyz.h>

where would I have to put it / which environment variables would I have to set so that gcc/g++ (by Geany IDE) will always find it for compile/build ?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
joan
Posts: 14069
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: is there a standard path to #include libs system-wide?

Tue Dec 22, 2015 4:35 pm

I'm not sure. I've seen the following used.

/usr/local/include for header files (.h)
/usr/local/lib for libraries (.a, .so)

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: is there a standard path to #include libs system-wide?

Tue Dec 22, 2015 4:44 pm

thank you, I'll try that!
8-)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

swampdog
Posts: 218
Joined: Fri Dec 04, 2015 11:22 am

Re: is there a standard path to #include libs system-wide?

Thu Dec 31, 2015 2:14 am

You'd ordinarily build things from source thusly..

Code: Select all

$ mkdir -p ~/usr/src/autoconf
$ cd ~/usr/src/autoconf
$ wget -c http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
$ tar xvJf autoconf-2.69.tar.xz
$ mkdir obj && cd obj
$ ../autoconf-2.69/configure --help
$ ../autoconf-2.69/configure --prefix=/usr/local
$ make
$ sudo make install
However not all packages play ball in various ways and quite a lot don't uninstall completely so in my experience it's best to install it somewhere daft initially. eg:

Code: Select all

$ ../autoconf-2.69/configure --prefix=$HOME/usr/FOO
$ make
$ make install
Check out it works then repeat with --prefix=/usr/local. The only problem with installing things somewhere daft is they might not want to run so you'll probably end up having to type something like this..

Code: Select all

$ PATH=$HOME/usr/FOO/bin:$PATH LD_LIBRARY_PATH=$HOME/usr/FOO/lib:$LD_LIBRARY_PATH $HOME/usr/FOO/bin/autoconf --version
..but at least you can completely remove it with a simple "rm -rf $HOME/usr/FOO/". It can be a real headache if you install something which conflicts with a system package: which 'autoconf' is getting called? It will depend upon your PATH search order.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: is there a standard path to #include libs system-wide?

Thu Dec 31, 2015 9:09 am

@swampdog
hey,
thank you, but I personally never use commandline make, I am always compiling via Geany IDE build settings!
And so for my proprietary source codes it woud be fine to put libs of either kind just into this "general libraries directory".

Just the way as it is possible for the Arduino IDE where you have all system libraries in
c:\Arduino\libraries\
and all what's in there can be accessed immediately by the compiler and linker just putting the lib name into <...> like, e.g.,
#include <Scheduler.h>
#include <tinyGPS.h>

That's roughly the functionality which I was longing for...

Commands like yours large enough to sink a ship are far too weird to me as a simple beginner and hobbyist 8-)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

Return to “C/C++”