From: "David Schwartz" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: <[EMAIL PROTECTED]> Subject: RE: compiling a c program whit openssl problem Date: Mon, 1 Mar 2004 17:54:28 -0800
> [...] > when i try to compile a c program whit some openssl function in it .... > a program thats look like this... > > [...] > > when i do cc -o rsa_test rsa_test.c (to compile it) i always get > > /tmp/ccchRiVH.o(.text+0x3b): In function `main': > : undefined reference to `RSA_generate_key' > collect2: ld returned 1 exit status > > what i am doing wrong????
Did you install OpenSSL or did it come with your system/distribution?
> i also tryed to compile the the RSA_generate_key sample program > located in > the tarball of openssl > (openssl/demos/eay/loadrsa.c) > > and i get the same mistake for every openssl function.... > > someone tol me i probably need to set a library on my compile comand > line.... but i cant find any help on this.... > ????
That's system-specific. Perhaps '-lssl -lcrypto' will do it, perhaps not.
How did your OpenSSL headers get in your include path?
DS
i did not install openssl it was installed a system instalation (red hat 9.0)
This response tells me that you are at the very start of your process of acquiring clues. That's OK. Each of us was clueless once. Those of us who are still programmers have gotten past our cluelessness.
You've been told with some specificity what you need to do. At the risk of hurting your feelings, I'm going to re-phrase David's suggestion using unambiguously specific language:
You need to tell the linker about the SSL libraries by adding "-lssl -lcrypto" to your cc command, like this:
gcc -o rsa_test rsa_test.c -lssl -lcrypto
That should get you past this particular problem. Be prepared for *many* more like this and worse. If you like puzzles, you'll do fine. Programming computers to do useful things is a walk in a maze, but the maze is full of patterns once you learn to see them.
Good luck!
Paul Allen
-- Boeing Phantom Works \ Paul L. Allen, (425) 865-3297 Math & Computing Technology \ [EMAIL PROTECTED] POB 3707 M/S 7L-40, Seattle, WA 98124-2207 \ Prototype Systems Group
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]