Are ran1,ran2, ran3 functions are included in the library ? Does these needs some header file or package ? How to mention in the program and how to call .
I just know the basic programmings .I am trying to learn random variable generators .I have looked in the book numerical recipe there are three functions ran1,ran2 and ran3.I want to know how this function called or used in the program ? How to mention this functions in my program?
In order to use a function (ran1()
, ran2()
or ran3()
) from a library X you usually have to include the header in your_file.c
:
#include <X.h>
Tell the compiler which directory to find said header if it's in a non-standard location. Say, the header is path/include/X.h
, then you would compile the file with:
gcc -Ipath/include -c your_file.c
And you link the library by using the -L to tell where the dynamic library is located, say, path/lib/libX.so
:
gcc -Lpath/lib -lX your_file.o -o your_file
If your library ships with a .pc file then you use pkg-config --cflags libX
for the compilation, and pkg-config --libs libX
for linking. Note there is some variability in the naming of the pc file so look at what your library uses if any.