views:

887

answers:

1

Hello, everyone.

I've been using the UVa Online Judge to solve some programming challenges, and, when submitting my solutions, I'm told the judge will compile my code using the following parameters to GCC/G++ that I don't know: -lm -lcrypt -pipe -DONLINE_JUDGE.

What do they do? Thank you very much in advance!

+18  A: 

"-lm -lcrypt" specifies to link with the math and cryptography libraries - useful if you're going to use the functions defined in math.h and crypt.h. "-pipe" just means it won't create intermediate files but will use pipes instead. "-DONLINE_JUDGE" defines a macro called "ONLINE_JUDGE", just as if you'd put a "#define" in your code. I guess that's so you can put something specific to the judging in your code in an "#ifdef"/"#endif" block.

Paul Tomblin
"to include the math and cryptography libraries" should be "link to the math and cryptography libraries".
Georg Fritzsche
Not a bad suggestion, @gf.
Paul Tomblin
Just for completeness: -l<...> links the libraries "lib<...>.so*". So -lm links "libm.so*" and -lcrypt links "libcrypt.so*".
rstevens