PDA

View Full Version : undefined reference to `RAND_add'


ganesh_mak
07-19-2006, 11:44 AM
i have written a c program which uses RAND_add() and RAND-seed() function.

#include<stdio.h>
#include<openssl/rand.h>

int main(int argc, char *argv[])
{
RAND_seed(argv[1], strlen(argv[1]));
RAND_add(argv[2], strlen(argv[2]), 343462.4365243697);
// some code here
return ;
}


i am getting 'undefined reference RAND_add
and 'undefined reference RAND_seed error during compilation

can somebody help me out in this simple link problem

ganesh_mak
07-19-2006, 12:56 PM
i have written a c program which uses RAND_add() and RAND-seed() function.

#include<stdio.h>
#include<openssl/rand.h>

int main(int argc, char *argv[])
{
RAND_seed(argv[1], strlen(argv[1]));
RAND_add(argv[2], strlen(argv[2]), 343462.4365243697);
// some code here
return ;
}


i am getting 'undefined reference RAND_add
and 'undefined reference RAND_seed error during compilation

can somebody help me out in this simple link problem


i got it trhough the command line
cc generate_key.c -o generate_key -lc /usr/lib/libcrypto.so
but i want to compile and link it using "cc generate_key.c -o generate_key "
so which file i have to edit to pt the link od shared obj file.

rpgfan3233
07-19-2006, 11:03 PM
Have you tried using "gcc" instead of "cc" ?