gcc -c compiles source files without linking.
This flag helps us to specify the name of the final executable produced by GCC. It places the output of the final executable in a file “file” as specified along with the flag.
By default, GCC limits the size of functions that can be inlined. This flag allows the control of this limit for functions that are explicitly marked as inline (i.e., marked with the inline keyword or defined within the class definition in c++).
gcc -Wall enables all compiler's warning messages. This option should always be used, in order to generate better code.
Try:
gcc -dumpspecs | grep pthread
and look for anything that starts with %{pthread:
.
On my computer, this causes files to be compiled with -D_REENTRANT
, and linked with -lpthread
. On other platforms, this could differ. Use -pthread
for most portability.
Using _REENTRANT
, on GNU libc, changes the way some libc headers work. As a specific example, it makes errno
call a function returning a thread-local location.
From man gcc
:
-pthread Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With