Re: POSIX thread question




David Schwartz wrote:
Michael Rasmussen wrote:


Only if '-pthread' doesn't work for some reason. The '-pthread' option
is standard. The '-lpthread' option happens to be correct for some
current Linux platforms.

I tried the following command, it works:
gcc -pthread -o threadapp threadapp.c

My book suggests the following:
gcc -pthread threadapp.c -o threadapp -lpthread

What is the different? Which on is better?

Thanks.

Jack

.



Relevant Pages

  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... GNU C is the C-like language accepted by gcc. ... violate the C standard. ... that you get the GNU C version of each library rather than the ANSI ...
    (comp.lang.c)
  • Re: [OT] lcc first experience
    ... GCC does embrace-and-extend? ... affect the behaviour of a strictly conforming program. ... Of course if implementations are called "lcc-win" you will start ranting ... making them 100% compatible with the C standard. ...
    (comp.lang.c)
  • Re: KEil bought by ARM
    ... >> against and that a user of gcc can add tests to. ... > tests demonstrate conformance to a recognized C standard like C89 ... and possibly with some extensions. ... > were renumbered and became clauses in the ISO standard. ...
    (comp.arch.embedded)
  • Re: non-standard functions in libc -- bad design?
    ... standard supported by a compiler/library, ... I'd call them extensions. ... gcc doesn't get a vote. ... gcc is just a compiler, ...
    (comp.lang.c)
  • Re: Variable declaration - Is this valid in standard C?
    ... YES it is valid in standard C!!!! ... doesn't have a conforming C90 compiler (ignoring minor bugs, ... are in C99 but not in C90. ... That's what the gcc project's own web site says, ...
    (comp.lang.c)