This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
RE: pthread declaration problem
- From: jefe goode <jefe_goode at yahoo dot com>
- To: Mark Weaver <mark at npsl dot co dot uk>, pthreads-win32 at sources dot redhat dot com
- Date: Wed, 12 May 2004 01:37:31 +0100 (BST)
- Subject: RE: pthread declaration problem
Mark
Complete program below:
compiler output is 7 errors -- (all type info not
found -- the other 6 errors are knock-on ones )
C:\PROJECTS\CP3\Thread1\Thread1.cpp(22) : error C2065:
'pthread_t' : undeclared identifier
Regards and Thanks
Jefe
--------------- Listing below --------------
#include "Thread.h"
#include "pthread.h"
#include "sched.h"
#include "semaphore.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include "stdafx.h"
void print_message_function( void *ptr );
int main(int argc, char* argv[])
{
pthread_t thread1, thread2;
char *message1 = "Hello";
char *message2 = "World";
pthread_create( &thread1, pthread_attr_default,
(void*)&print_message_function,
(void*) message1);
pthread_create(&thread2, pthread_attr_default,
(void*)&print_message_function,
(void*) message2);
exit(0);
return 0;
}
void print_message_function( void *ptr )
{
char *message;
message = (char *) ptr;
printf("%s ", message);
}
--------- end listing -----------------
--- Mark Weaver <mark@npsl.co.uk> wrote: > >
> >
> > Thanks Mark,
> >
> > Yes, it fails to compile and #include "pthread.h"
> is
> > included;
> > pthread_t tid; //fails to compile
> >
> >
> Try posting the complete program together with the
> compiler output.
>
> Mark
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html