[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make a 'pthread' program ?

From: Bob Friesenhahn
Subject: Re: How to make a 'pthread' program ?
Date: Mon, 2 Jan 2006 10:49:50 -0600 (CST)

On Tue, 3 Jan 2006, Steven Woody wrote:

on linux, simplly adding a '-pthread' option to the command line gcc, i can
make a multi-thread c program. but if using automake, i only got many
undefined reference to pthread_xxx errors. i've already add the '-pthread'
to the myprogram_CFLAGS variable.

The '-pthread' option is a non-standard compiler extension which causes different pre-processor definitions to be applied, and different/additional libraries to be applied. You should not assume that other compilers/platforms work with '-pthread'. So if you insert it into myprogram_CFLAGS then your package will only work if the compiler supports the '-pthread' option.

Note that CFLAGS is only applied when compiling. The LDFLAGS value is used while linking so if you want to use '-pthread' then you should supply it for both CFLAGS and LDFLAGS.

The Autoconf macro archive includes a macro for determining the correct options to use in a platform-independent way.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]