C
cpptutor2000
Could some C guru please help me? I have a simple piece of code as:
#include <stdio.h>
#include <stdlib.h>
#include <openssl/rand.h>
int main(){
unsigned char temp[4];
RAND_bytes(temp, 4);
return 0;
}
If I type: whereis openssl
I get: openssl: /usr/bin/openssl /usr/include/openssl
/usr/share/man/man1/openssl.1ssl.gz
I compile this as:
gcc -g -o test test.c -I/usr/include/openssl -L/usr/bin/openssl
I get a linker error message as :
/tmp/cc4tQEqd.o(.text+0x1af0): In function `main':
/home/ecelrc/students/abanerj/cpp/test.c:6: undefined reference to
`RAND_bytes'
Could someone please point out what I am doing wrong? Any help would be
greatly
appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <openssl/rand.h>
int main(){
unsigned char temp[4];
RAND_bytes(temp, 4);
return 0;
}
If I type: whereis openssl
I get: openssl: /usr/bin/openssl /usr/include/openssl
/usr/share/man/man1/openssl.1ssl.gz
I compile this as:
gcc -g -o test test.c -I/usr/include/openssl -L/usr/bin/openssl
I get a linker error message as :
/tmp/cc4tQEqd.o(.text+0x1af0): In function `main':
/home/ecelrc/students/abanerj/cpp/test.c:6: undefined reference to
`RAND_bytes'
Could someone please point out what I am doing wrong? Any help would be
greatly
appreciated.