On 08/09/2011 04:10 AM, florent ainardi wrote:
i have a little problem when i try to compil my program
nss and nspr are installed on my system

when i launch gcc with the following syntax

gcc -g test.c -otest -I/usr/include/nss -I/usr/include/nspr

i have the following error
................
undefined reference to 'PR_Init'
undefined reference to 'NSS_NoDB_Init'
undefined reference to 'PR_Get_Error'

do you have an idea ?

Yes, but the real question is why don't you? Your questions on this list suggest you're struggling with basic computer science. With all due respect you need to take some courses in fundamentals. This list is dedicated to advanced topics in computer security, it is not the place to learn how to compile and link, one of the very first topics in a computer science education.

The answer to your question is that you need to supply the nss and nspr libraries which contain those symbols to the linker. This is done with the -l command line arg passed to gcc when you're building a final executable image. The "undefined reference" error means the linker (do you know what that is?) is unable to resolve (i.e. locate the compiled code) for those functions because they are not in your test.c program, rather they are in the nss and nspr libraries, hence your test.c program makes a reference to a symbol which is undefined. So where is it defined? In the nss and nspr libraries!

Pay particular attention to the -I and -l command line args and be sure to understand the distinction between them. In previous emails you incorrectly conflated include files and libraries. They play very distinct and separate roles during the build process.

In the future I'm sure the folks on this list would be happy to help you with actual issues with NSS, PKI and cryptography, but not with computer science 101 :-) As a courtesy to others on this list such things are said to be "off topic".

HTH,

John

--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to