It is currently Fri, 23 Aug 2019 23:01:28 GMT

Author Message
 Errors compiling with ftok(), struct timespec, and pthreads
I am having a terrible time trying to port an application from AIX and Linux to
Solaris.  I am simply trying to use both ftok(), variables of type struct
timespec, and pthreads in the same source file.  I cannot find the set of
"magic" compiler switches that will let this work.  Below is a trivial example
that illustrates my problem.  I am using Solaris 5.6 with gcc 2.95.2.  I have
tried every permutation I can find for _POSIX_C_SOURCE, _XOPEN_SOURCE, and
_XOPEN_SOURCE_EXTENDED.  I need the POSIX defines for the struct timespec, and I
need the XOPEN defines for the ftok().  I get various when I try different
combinations.  Any help is greatly appreciated.


#include <pthread.h>
#include <sys/ipc.h>
#include <sys/time.h>

int foo(void)
    pthread_t theThread = 0;
    struct timespec aTimeSpec = ( 0, 0 };
    key_t theKey = ftok("/", 0);

    return 0;

As an example, the following command


generates the following output from the compiler

In file included from /usr/include/sys/signal.h:123,
                 from /usr/include/pthread.h:13,
                 from trivial.cpp:1:
/usr/include/sys/siginfo.h:204: field `__value' has incomplete type
In file included from /usr/include/pthread.h:14,
                 from trivial.cpp:1:
/usr/include/sys/time.h:222: field `it_interval' has incomplete type
/usr/include/sys/time.h:223: field `it_value' has incomplete type
trivial.cpp: In function `int foo()':
trivial.cpp:8: variable `struct timespec aTimeSpec' has initializer but
incomplete type
trivial.cpp:8: aggregate `{error} aTimeSpec' has incomplete type and cannot be

Charles Rankin (
IBM NCSD Austin - I don't speak for IBM

 Sun, 28 Jul 2002 03:00:00 GMT   
 Errors compiling with ftok(), struct timespec, and pthreads

In article <87s7e4$>,
  "Charles Rankin" <> wrote:


- Show quoted text -


- Show quoted text -

Sent via
Before you buy.

 Mon, 29 Jul 2002 03:00:00 GMT   
   [ 2 post ] 

Similar Threads

1. struct timespec (in sys/time.h) fields: ts_ or tv_

2. struct timespec and pthread_cond_timedwait

3. struct timespec for stat - core changes 1/3

4. struct timespec for stat - driver changes 2/3

5. using struct timespec

6. Problem compiling with kstat.h, struct mntinfo_kstat

7. Simple STRUCT wont compile

8. pthreads problem compiling Sendmail with Berkeley DB

9. glib compiling&pthreads

10. glib compiling&pthreads

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software