Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are these GCC/G++ parameters?

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!

like image 367
jpmelos Avatar asked Oct 03 '09 01:10

jpmelos


People also ask

What is G in GCC?

The gcc -g flag tells gcc to generate and embed debug information. ulimit -c is used to enable core file generation. You can have either of these without the other. Copy link CC BY-SA 2.5.

What is the purpose of the flags G and O in GCC?

-g means to leave debugging information in the output file, it's unrelated to renaming. -o means to put the result in the specified file instead of the default filename ( abc.o for object files, a. out for linked executable files).

What is G ++ GCC?

g++ is used to compile C++ program. gcc is used to compile C program. g++ can compile any . c or . cpp files but they will be treated as C++ files only.


1 Answers

"-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.

like image 92
Paul Tomblin Avatar answered Oct 04 '22 01:10

Paul Tomblin